Search in sources :

Example 36 with DoubleSummaryStatistics

use of java.util.DoubleSummaryStatistics in project hazelcast-jet by hazelcast.

the class CollectorsTest method list_summarizingDouble.

@Test
public void list_summarizingDouble() {
    DoubleSummaryStatistics summary = streamList().collect(DistributedCollectors.summarizingDouble(m -> (double) m));
    assertEquals(COUNT, summary.getCount());
    assertEquals(COUNT - 1, summary.getMax(), 0d);
    assertEquals(0, summary.getMin(), 0d);
    assertEquals(COUNT * (COUNT - 1) / 2d, summary.getSum(), 0d);
    assertEquals((COUNT - 1) / 2d, summary.getAverage(), 0d);
}
Also used : Collection(java.util.Collection) IMapJet(com.hazelcast.jet.IMapJet) Set(java.util.Set) Assert.assertTrue(org.junit.Assert.assertTrue) DistributedComparator(com.hazelcast.jet.function.DistributedComparator) Test(org.junit.Test) IListJet(com.hazelcast.jet.IListJet) DoubleSummaryStatistics(java.util.DoubleSummaryStatistics) TreeSet(java.util.TreeSet) List(java.util.List) ICacheJet(com.hazelcast.jet.ICacheJet) Assert.assertFalse(org.junit.Assert.assertFalse) Map(java.util.Map) Entry(java.util.Map.Entry) Optional(java.util.Optional) IntSummaryStatistics(java.util.IntSummaryStatistics) Comparator(java.util.Comparator) LongSummaryStatistics(java.util.LongSummaryStatistics) Assert.assertEquals(org.junit.Assert.assertEquals) DoubleSummaryStatistics(java.util.DoubleSummaryStatistics) Test(org.junit.Test)

Example 37 with DoubleSummaryStatistics

use of java.util.DoubleSummaryStatistics in project hazelcast-jet by hazelcast.

the class DoubleStreamTest method summaryStatistics.

@Test
public void summaryStatistics() {
    DoubleSummaryStatistics longSummaryStatistics = stream.summaryStatistics();
    assertEquals(COUNT, longSummaryStatistics.getCount());
    assertEquals(COUNT - 1, longSummaryStatistics.getMax(), 0D);
    assertEquals(0, longSummaryStatistics.getMin(), 0D);
    assertEquals(COUNT * (COUNT - 1) / 2, longSummaryStatistics.getSum(), 0D);
    assertEquals((COUNT - 1) / 2D, longSummaryStatistics.getAverage(), 0D);
}
Also used : DoubleSummaryStatistics(java.util.DoubleSummaryStatistics) Test(org.junit.Test)

Example 38 with DoubleSummaryStatistics

use of java.util.DoubleSummaryStatistics in project j2objc by google.

the class DoubleSummaryStatisticsTest method test_getCount.

public void test_getCount() {
    DoubleSummaryStatistics dss1 = getDoubleSummaryStatisticsData1();
    assertEquals(data1.length, dss1.getCount());
}
Also used : DoubleSummaryStatistics(java.util.DoubleSummaryStatistics)

Example 39 with DoubleSummaryStatistics

use of java.util.DoubleSummaryStatistics in project j2objc by google.

the class DoubleSummaryStatisticsTest method test_getAverage.

public void test_getAverage() {
    DoubleSummaryStatistics dss1 = getDoubleSummaryStatisticsData1();
    assertEquals(21.2, dss1.getAverage(), 1E-6);
    dss1.accept(Double.NaN);
    assertEquals(Double.NaN, dss1.getAverage());
}
Also used : DoubleSummaryStatistics(java.util.DoubleSummaryStatistics)

Aggregations

DoubleSummaryStatistics (java.util.DoubleSummaryStatistics)39 Arrays (java.util.Arrays)9 List (java.util.List)9 Test (org.junit.Test)9 Layer (com.simiacryptus.mindseye.lang.Layer)8 Tensor (com.simiacryptus.mindseye.lang.Tensor)8 LongSummaryStatistics (java.util.LongSummaryStatistics)8 IntStream (java.util.stream.IntStream)8 Nonnull (javax.annotation.Nonnull)8 Nullable (javax.annotation.Nullable)8 TrainingMonitor (com.simiacryptus.mindseye.opt.TrainingMonitor)7 Map (java.util.Map)6 LoggingWrapperLayer (com.simiacryptus.mindseye.layers.java.LoggingWrapperLayer)5 MonitoringWrapperLayer (com.simiacryptus.mindseye.layers.java.MonitoringWrapperLayer)5 StochasticComponent (com.simiacryptus.mindseye.layers.java.StochasticComponent)5 DAGNetwork (com.simiacryptus.mindseye.network.DAGNetwork)5 DAGNode (com.simiacryptus.mindseye.network.DAGNode)5 Step (com.simiacryptus.mindseye.opt.Step)5 MonitoredObject (com.simiacryptus.util.MonitoredObject)5 DoubleStatistics (com.simiacryptus.util.data.DoubleStatistics)5