Class/Object

com.twitter.algebird

AveragedValue

Related Docs: object AveragedValue | package algebird

Permalink

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

Source
AveragedValue.scala
See also

MomentsGroup.getCombinedMean for implementation of +

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AveragedValue
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new AveragedValue(count: Long, value: Double)

    Permalink

    count

    the number of aggregated items

    value

    the average value of all aggregated items

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +[N](that: N)(implicit num: Numeric[N]): AveragedValue

    Permalink

    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.

  4. def +(that: Double): AveragedValue

    Permalink

    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.

  5. def +(r: AveragedValue): AveragedValue

    Permalink

    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.

  6. def -(r: AveragedValue): AveragedValue

    Permalink

    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

  7. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. val count: Long

    Permalink

    the number of aggregated items

  11. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  19. def unary_-: AveragedValue

    Permalink

    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
  20. val value: Double

    Permalink

    the average value of all aggregated items

  21. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped