Package com.hazelcast.jet.accumulator
Class LinTrendAccumulator
- java.lang.Object
-
- com.hazelcast.jet.accumulator.LinTrendAccumulator
-
public final class LinTrendAccumulator extends java.lang.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 ofBigInteger
and the finished value is adouble
-valued linear coefficient.- Since:
- Jet 3.0
-
-
Constructor Summary
Constructors Constructor Description LinTrendAccumulator()
Constructs a new accumulator with all components at zero.LinTrendAccumulator(long n, java.math.BigInteger sumX, java.math.BigInteger sumY, java.math.BigInteger sumXY, java.math.BigInteger sumX2)
Creates a new accumulator with the given components.
-
Method Summary
All Methods Instance Methods Concrete Methods 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(java.lang.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 Detail
-
LinTrendAccumulator
public LinTrendAccumulator()
Constructs a new accumulator with all components at zero.
-
LinTrendAccumulator
public LinTrendAccumulator(long n, java.math.BigInteger sumX, java.math.BigInteger sumY, java.math.BigInteger sumXY, java.math.BigInteger sumX2)
Creates a new accumulator with the given components. Intended only for testing and deserialization.
-
-
Method Detail
-
accumulate
public LinTrendAccumulator accumulate(long x, long y)
Accumulates a new sample.
-
combine
public LinTrendAccumulator combine(LinTrendAccumulator that)
Combines this accumulator with the supplied one.
-
deduct
public LinTrendAccumulator deduct(LinTrendAccumulator that)
Deducts the supplied accumulator from this one.
-
export
public double export()
Computes the linear coefficient of the linear regression of the accumulated samples.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
writeObject
public void writeObject(ObjectDataOutput out) throws java.io.IOException
Serializes this accumulator.- Throws:
java.io.IOException
-
-