case class AveragedValue(count: Long, value: Double) extends Product with Serializable
Tracks the count and mean value of Doubles in a data stream.
Adding two instances of AveragedValue with + is equivalent to taking an average of the two streams, with each stream weighted by its count.
The mean calculation uses a numerically stable online algorithm suitable for large numbers of records, similar to Chan et. al.'s parallel variance algorithm on Wikipedia. As long as your count doesn't overflow a Long, the mean calculation won't overflow.
- count
the number of aggregated items
- value
the average value of all aggregated items
- See also
MomentsGroup.getCombinedMean for implementation of +
- Alphabetic
- By Inheritance
- AveragedValue
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new AveragedValue(count: Long, value: Double)
- count
the number of aggregated items
- value
the average value of all aggregated items
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +[N](that: N)(implicit num: Numeric[N]): AveragedValue
Returns a new instance that averages
that
into this instance.Returns a new instance that averages
that
into this instance.- that
value to average into this instance
- returns
an instance representing the mean of this instance and
that
.
- def +(that: Double): AveragedValue
Returns a new instance that averages
that
into this instance.Returns a new instance that averages
that
into this instance.- that
value to average into this instance
- returns
an instance representing the mean of this instance and
that
.
- def +(r: AveragedValue): AveragedValue
Averages this instance with another AveragedValue instance.
Averages this instance with another AveragedValue instance.
- r
the other instance
- returns
an instance representing the mean of this instance and
r
.
- def -(r: AveragedValue): AveragedValue
Averages this instance with the *opposite* of the supplied AveragedValue instance, effectively subtracting out that instance's contribution to the mean.
Averages this instance with the *opposite* of the supplied AveragedValue instance, effectively subtracting out that instance's contribution to the mean.
- r
the instance to subtract
- returns
an instance with
r
's stream subtracted out
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- val count: Long
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def unary_-: AveragedValue
Returns a copy of this instance with a negative value.
Returns a copy of this instance with a negative value. Note that
a + -b == a - b
- val value: Double
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()