Package com.hazelcast.jet.accumulator
Class LinTrendAccumulator
java.lang.Object
com.hazelcast.jet.accumulator.LinTrendAccumulator
public final class LinTrendAccumulator extends Object
Maintains the components needed to compute the linear regression on a
set of
(long, long)
pairs. The intermediate results are held in
the form of BigInteger
and the finished value is a
double
-valued linear coefficient.- Since:
- 3.0
-
Constructor Summary
Constructors Constructor Description LinTrendAccumulator()
Constructs a new accumulator with all components at zero.LinTrendAccumulator(long n, BigInteger sumX, BigInteger sumY, BigInteger sumXY, BigInteger sumX2)
Creates a new accumulator with the given components. -
Method Summary
Modifier and Type Method Description LinTrendAccumulator
accumulate(long x, long y)
Accumulates a new sample.LinTrendAccumulator
combine(LinTrendAccumulator that)
Combines this accumulator with the supplied one.LinTrendAccumulator
deduct(LinTrendAccumulator that)
Deducts the supplied accumulator from this one.boolean
equals(Object obj)
double
export()
Computes the linear coefficient of the linear regression of the accumulated samples.int
hashCode()
void
writeObject(ObjectDataOutput out)
Serializes this accumulator.
-
Constructor Details
-
LinTrendAccumulator
public LinTrendAccumulator()Constructs a new accumulator with all components at zero. -
LinTrendAccumulator
public LinTrendAccumulator(long n, BigInteger sumX, BigInteger sumY, BigInteger sumXY, BigInteger sumX2)Creates a new accumulator with the given components. Intended only for testing and deserialization.
-
-
Method Details
-
accumulate
Accumulates a new sample. -
combine
Combines this accumulator with the supplied one. -
deduct
Deducts the supplied accumulator from this one. -
export
public double export()Computes the linear coefficient of the linear regression of the accumulated samples. -
equals
-
hashCode
public int hashCode() -
writeObject
Serializes this accumulator.- Throws:
IOException
-