public class SampleSummaryStatistics extends Object implements Consumer<Sample>
DoubleSummaryStatistics
class.
final Stream<Sample> stream = ...
final SampleSummaryStatistics statistics = stream.collect(
() -> new SampleSummaryStatistics(parameterCount),
SampleSummaryStatistics::accept,
SampleSummaryStatistics::combine
);
Implementation note:
This implementation is not thread safe. However, it is safe to use
toSampleStatistics(int)
on a parallel stream,
because the parallel implementation of
Stream.collect()
provides the necessary partitioning, isolation, and merging of results for
safe and efficient parallel execution.
Constructor and Description |
---|
SampleSummaryStatistics(int parameterCount)
Create a new statistics object with the given expected parameter count of
the accepted samples.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(Sample sample) |
SampleSummaryStatistics |
combine(SampleSummaryStatistics other)
Combine two
SampleSummaryStatistics statistic objects. |
ISeq<DoubleMomentStatistics> |
getMoments()
Return the raw
DoubleMomentStatistics objects. |
ISeq<org.jenetics.tool.trial.ExactQuantile> |
getQuantiles()
Return the quantile object.
|
static Collector<Sample,?,SampleSummaryStatistics> |
toSampleStatistics(int parameterCount)
Return a
Collector which applies an double-producing mapping
function to each input element, and returns moments-statistics for the
resulting values. |
public SampleSummaryStatistics(int parameterCount)
parameterCount
- the parameter count or sample size, respectivelyIllegalArgumentException
- if the given parameterCount
is smaller then onepublic SampleSummaryStatistics combine(SampleSummaryStatistics other)
SampleSummaryStatistics
statistic objects.other
- the other SampleSummaryStatistics
statistics to
combine with this
one.this
statistics objectIllegalArgumentException
- if the parameterCount
of the
other
statistics object is different to this
oneNullPointerException
- if the other statistical summary is
null
.public ISeq<DoubleMomentStatistics> getMoments()
DoubleMomentStatistics
objects.DoubleMomentStatistics
objectspublic ISeq<org.jenetics.tool.trial.ExactQuantile> getQuantiles()
public static Collector<Sample,?,SampleSummaryStatistics> toSampleStatistics(int parameterCount)
Collector
which applies an double-producing mapping
function to each input element, and returns moments-statistics for the
resulting values.
final Stream<Sample> stream = ...
final SampleSummaryStatistics statistics = stream
.collect(toDoubleMomentStatistics(parameterCount));
parameterCount
- the number of parameter of the accumulated
Sample
objectsCollector
implementing the sample reductionIllegalArgumentException
- if the given parameterCount
is smaller then one© 2007-2016 Franz Wilhelmstötter (2016-12-26 11:02)