# Proportions

#### trait Proportions extends Masses with ReadOnlyTensor

A Tensor containing non-negative numbers summing to 1.0. It is the parameter of a Discrete or Multinomial distribution. Proportions contain Masses, which may not sum to 1.0; some Proportions subclasses can have their value changed by incrementing these inner masses. All Proportions also inherit directly from Masses, but, naturally, these Masses always sum to 1.0, and generally are not directly mutable.

Linear Supertypes
Ordering
1. Alphabetic
2. By inheritance
Inherited
1. Proportions
3. Masses
4. Tensor
5. Serializable
6. Serializable
7. MutableDoubleSeq
8. IncrementableDoubleSeq
9. DoubleSeq
10. AnyRef
11. Any
1. Hide All
2. Show all
Visibility
1. Public
2. All

### Abstract Value Members

1. #### abstract def =+(a: Array[Double], offset: Int, f: Double): Unit

Increment given array (starting at offset index) with contents of this DoubleSeq, multiplied by factor f.

Increment given array (starting at offset index) with contents of this DoubleSeq, multiplied by factor f.

Definition Classes
DoubleSeq
2. #### abstract def activeDomain: IntSeq

Definition Classes
Tensor
3. #### abstract def activeDomainSize: Int

Definition Classes
Tensor
4. #### abstract def activeDomains: Array[IntSeq]

Definition Classes
Tensor
5. #### abstract def apply(i: Int): Double

Definition Classes
DoubleSeq
6. #### abstract def blankCopy: Tensor

Definition Classes
Tensor
7. #### abstract def contains(d: Double): Boolean

Definition Classes
DoubleSeq
8. #### abstract def containsNaN: Boolean

Definition Classes
DoubleSeq
9. #### abstract def copy: Tensor

Definition Classes
Tensor
10. #### abstract def dimensions: Array[Int]

Definition Classes
Tensor
11. #### abstract def dot(ds: DoubleSeq): Double

Definition Classes
Tensor
12. #### abstract def forallActiveElements(f: (Int, Double) ⇒ Boolean): Boolean

Definition Classes
Tensor
13. #### abstract def foreachActiveElement(f: (Int, Double) ⇒ Unit): Unit

Definition Classes
DoubleSeq
14. #### abstract def indexOf(d: Double): Int

Definition Classes
DoubleSeq
15. #### abstract def infinityNorm: Double

Definition Classes
DoubleSeq
16. #### abstract def isDense: Boolean

Definition Classes
Tensor
17. #### abstract def length: Int

Definition Classes
DoubleSeq
18. #### abstract def massTotal: Double

Definition Classes
Masses

20. #### abstract def max: Double

Definition Classes
DoubleSeq
21. #### abstract def maxIndex: Int

Definition Classes
DoubleSeq
22. #### abstract def maxIndex2: (Int, Int)

Definition Classes
DoubleSeq
23. #### abstract def min: Double

Definition Classes
DoubleSeq
24. #### abstract def numDimensions: Int

Definition Classes
Tensor
25. #### abstract def oneNorm: Double

Definition Classes
DoubleSeq
26. #### abstract def sampleIndex(normalizer: Double)(implicit r: Random): Int

Definition Classes
DoubleSeq
27. #### abstract def toArray: Array[Double]

Return the values as an Array[Double].

Return the values as an Array[Double]. Guaranteed to be a copy, not just a pointer to an internal array that would change with changes to the DoubleSeq

Definition Classes
DoubleSeq
28. #### abstract def twoNormSquared: Double

Definition Classes
DoubleSeq

### Concrete Value Members

1. #### final def !=(arg0: AnyRef): Boolean

Definition Classes
AnyRef
2. #### final def !=(arg0: Any): Boolean

Definition Classes
Any
3. #### final def ##(): Int

Definition Classes
AnyRef → Any
4. #### def *(v: Double): Tensor

Definition Classes
Tensor
5. #### def *=(ds: DoubleSeq): Unit

Definition Classes
MutableDoubleSeq
6. #### def *=(d: Double): Unit

Definition Classes
MutableDoubleSeq
7. #### def *=(i: Int, incr: Double): Unit

Definition Classes
MutableDoubleSeq
8. #### def +(that: Tensor): Tensor

Definition Classes
Tensor
9. #### def ++=(tensors: Iterable[Tensor]): Proportions.this.type

Definition Classes
Tensor

11. #### def +=(ds: DoubleSeq, factor: DoubleSeq): Unit

Increment by the element-wise product of ds and factor.

Increment by the element-wise product of ds and factor.

Definition Classes
IncrementableDoubleSeq
12. #### def +=(a: Array[Double], factor: Double): Unit

Definition Classes
IncrementableDoubleSeq
13. #### def +=(ds: DoubleSeq, factor: Double): Unit

Definition Classes
IncrementableDoubleSeq
14. #### def +=(a: Array[Double]): Unit

Definition Classes
IncrementableDoubleSeq
15. #### final def +=(ds: DoubleSeq): Unit

Definition Classes
IncrementableDoubleSeq
16. #### def +=(d: Double): Unit

Definition Classes
IncrementableDoubleSeq
17. #### def -(that: Tensor): Tensor

Definition Classes
Tensor
18. #### def -=(ds: DoubleSeq): Unit

Definition Classes
IncrementableDoubleSeq
19. #### final def -=(d: Double): Unit

Definition Classes
IncrementableDoubleSeq
20. #### def -=(i: Int, incr: Double): Unit

Definition Classes
IncrementableDoubleSeq
21. #### def /(v: Double): Tensor

Definition Classes
Tensor
22. #### def /=(ds: DoubleSeq): Unit

Definition Classes
MutableDoubleSeq
23. #### final def /=(d: Double): Unit

Definition Classes
MutableDoubleSeq
24. #### final def /=(i: Int, incr: Double): Unit

Definition Classes
MutableDoubleSeq
25. #### def :=(a: Array[Double], offset: Int): Unit

Definition Classes
MutableDoubleSeq
26. #### def :=(a: Array[Double]): Unit

Definition Classes
MutableDoubleSeq
27. #### def :=(ds: DoubleSeq): Unit

Definition Classes
MutableDoubleSeq
28. #### def :=(d: Double): Unit

Definition Classes
MutableDoubleSeq
29. #### final def =+(a: Array[Double], f: Double): Unit

Definition Classes
DoubleSeq
30. #### final def =+(a: Array[Double], offset: Int): Unit

Definition Classes
DoubleSeq
31. #### final def =+(a: Array[Double]): Unit

Definition Classes
DoubleSeq
32. #### final def ==(arg0: AnyRef): Boolean

Definition Classes
AnyRef
33. #### final def ==(arg0: Any): Boolean

Definition Classes
Any
34. #### def abs(): Unit

Definition Classes
MutableDoubleSeq
35. #### def activeElements: Iterator[(Int, Double)]

Definition Classes
Tensor
36. #### def addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder

Append a string representation of this DoubleSeq to the StringBuilder.

Append a string representation of this DoubleSeq to the StringBuilder.

Definition Classes
DoubleSeq
37. #### def asArray: Array[Double]

Return the values as an Array[Double].

Return the values as an Array[Double]. Not guaranteed to be a copy; in fact if it is possible to return a pointer to an internal array, it will simply return this.

Definition Classes
DoubleSeq
38. #### final def asInstanceOf[T0]: T0

Definition Classes
Any
39. #### def asSeq: Seq[Double]

With uncopied contents

With uncopied contents

Definition Classes
DoubleSeq
40. #### def clone(): AnyRef

Attributes
protected[java.lang]
Definition Classes
AnyRef
Annotations
@throws( ... )
41. #### def cosineSimilarity(t: DoubleSeq): Double

Definition Classes
Tensor
42. #### def defaultValue: Double

The default value at indices not covered by activeDomain.

The default value at indices not covered by activeDomain. Subclasses may override this

Definition Classes
Tensor
43. #### def different(t: DoubleSeq, threshold: Double): Boolean

Definition Classes
DoubleSeq
44. #### def dimensionsMatch(t: Tensor): Boolean

Definition Classes
Tensor
45. #### def ensureDimensionsMatch(t: Tensor): Unit

Definition Classes
Tensor
46. #### def entropy: Double

Assumes that the values are already normalized to sum to 1.

Assumes that the values are already normalized to sum to 1.

Definition Classes
DoubleSeq
47. #### final def eq(arg0: AnyRef): Boolean

Definition Classes
AnyRef
48. #### def equals(arg0: Any): Boolean

Definition Classes
AnyRef → Any
49. #### def exists(f: (Double) ⇒ Boolean): Boolean

Definition Classes
Tensor
50. #### def expNormalize(logZ: Double): Unit

Exponential the elements of the array such that they are normalized to sum to one, but do so efficiently by providing logZ.

Exponential the elements of the array such that they are normalized to sum to one, but do so efficiently by providing logZ. Note that to maximize efficiency, this method does not verify that the logZ value was the correct one to cause proper normalization.

Definition Classes
MutableDoubleSeq
51. #### def expNormalize(): Double

Exponentiate the elements of the array, and then normalize them to sum to one.

Exponentiate the elements of the array, and then normalize them to sum to one.

Definition Classes
MutableDoubleSeq
52. #### def expNormalized: Tensor

Definition Classes
Tensor
53. #### def exponentiate(): Unit

Definition Classes
MutableDoubleSeq
54. #### def finalize(): Unit

Attributes
protected[java.lang]
Definition Classes
AnyRef
Annotations
@throws( classOf[java.lang.Throwable] )
55. #### def foldActiveElements(seed: Double, f: (Int, Double, Double) ⇒ Double): Double

Definition Classes
Tensor
56. #### def foldLeft[B](z: B)(f: (B, Double) ⇒ B): B

Definition Classes
DoubleSeq
57. #### def forall(f: (Double) ⇒ Boolean): Boolean

Definition Classes
DoubleSeq
58. #### def forallElements(f: (Int, Double) ⇒ Boolean): Boolean

Definition Classes
DoubleSeq
59. #### def foreach(f: (Double) ⇒ Unit): Unit

Definition Classes
DoubleSeq
60. #### def foreachElement(f: (Int, Double) ⇒ Unit): Unit

Definition Classes
DoubleSeq
61. #### final def getClass(): Class[_]

Definition Classes
AnyRef → Any
62. #### def hashCode(): Int

Definition Classes
AnyRef → Any
63. #### final def isInstanceOf[T0]: Boolean

Definition Classes
Any
64. #### def isUniform: Boolean

Definition Classes
Tensor
65. #### def jsDivergence(p: DoubleSeq): Double

Assumes that the values are already normalized to sum to 1.

Assumes that the values are already normalized to sum to 1.

Definition Classes
DoubleSeq
66. #### def klDivergence(p: DoubleSeq): Double

Assumes that the values in both DoubleSeq are already normalized to sum to 1.

Assumes that the values in both DoubleSeq are already normalized to sum to 1.

Definition Classes
DoubleSeq
67. #### def l2Similarity(t: DoubleSeq): Double

Definition Classes
DoubleSeq
68. #### def logpr(index: Int): Double

Definition Classes
Masses
69. #### def map(f: (Double) ⇒ Double): DoubleSeq

Definition Classes
DoubleSeq
70. #### def maxNormalize(): Unit

Definition Classes
MutableDoubleSeq
71. #### def maxToStringLength: Int

Definition Classes
Masses
72. #### def mkString: String

Definition Classes
DoubleSeq
73. #### def mkString(sep: String): String

Definition Classes
DoubleSeq
74. #### def mkString(start: String, sep: String, end: String): String

Definition Classes
DoubleSeq
75. #### final def ne(arg0: AnyRef): Boolean

Definition Classes
AnyRef
76. #### def normalize(): Double

Definition Classes
MutableDoubleSeq
77. #### def normalizeLogProb(): Double

expNormalize, then put back into log-space.

expNormalize, then put back into log-space.

Definition Classes
MutableDoubleSeq
78. #### def normalized: Tensor

Definition Classes
Tensor
79. #### final def notify(): Unit

Definition Classes
AnyRef
80. #### final def notifyAll(): Unit

Definition Classes
AnyRef
81. #### def oneNormalize(): Double

Definition Classes
MutableDoubleSeq
82. #### def outer(t: Tensor): Tensor

Definition Classes
Tensor
83. #### final def pr(i: Int): Double

Get a normalized entry in this Masses, which can be interpreted as a probability.

Get a normalized entry in this Masses, which can be interpreted as a probability.

Definition Classes
ProportionsMasses
Annotations
@inline()
84. #### def printLength: Int

Definition Classes
Tensor
85. #### def sampleIndex(implicit r: Random): Int

Careful, for many subclasses this is inefficient because it calls the method "sum" to get the normalizer.

Careful, for many subclasses this is inefficient because it calls the method "sum" to get the normalizer.

Definition Classes
MassesDoubleSeq
86. #### final def size: Int

Definition Classes
DoubleSeq
87. #### def stringPrefix: String

Definition Classes
ProportionsMassesTensor
88. #### def substitute(oldValue: Double, newValue: Double): Unit

Definition Classes
MutableDoubleSeq
89. #### def sum: Double

Definition Classes
MassesDoubleSeq
90. #### final def synchronized[T0](arg0: ⇒ T0): T0

Definition Classes
AnyRef
91. #### def toSeq: Seq[Double]

With copied contents

With copied contents

Definition Classes
DoubleSeq
92. #### def toString(): String

Definition Classes
ProportionsMassesTensor → AnyRef → Any
93. #### def top(n: Int): TopN[String]

Return records for the n elements with the largest values.

Return records for the n elements with the largest values.

Definition Classes
DoubleSeq
94. #### final def twoNorm: Double

Definition Classes
DoubleSeq
95. #### def twoNormalize(): Double

Definition Classes
MutableDoubleSeq
96. #### def twoSquaredNormalize(): Double

Definition Classes
MutableDoubleSeq
97. #### def update(i: Int, v: Double): Unit

Definition Classes
98. #### final def wait(): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )
99. #### final def wait(arg0: Long, arg1: Int): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )
100. #### final def wait(arg0: Long): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )