org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic Java Examples
The following examples show how to use
org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AggregateMathFunction.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 5 votes |
@Override public FieldValue evaluate(List<FieldValue> arguments){ StorelessUnivariateStatistic statistic = createStatistic(); DataType dataType = null; for(int i = 0; i < arguments.size(); i++){ FieldValue value = getOptionalArgument(arguments, i); // "Missing values in the input to an aggregate function are simply ignored" if(FieldValueUtil.isMissing(value)){ continue; } statistic.increment((value.asNumber()).doubleValue()); if(dataType != null){ dataType = TypeUtil.getCommonDataType(dataType, value.getDataType()); } else { dataType = value.getDataType(); } } // "If all inputs are missing, then the result evaluates to a missing value" if(statistic.getN() == 0){ return FieldValues.MISSING_VALUE; } Double result = statistic.getResult(); return FieldValueUtil.create(getResultDataType(dataType), OpType.CONTINUOUS, result); }
Example #2
Source File: PSquarePercentileTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Verifies that copied statistics remain equal to originals when * incremented the same way by making the copy after a majority of elements * are incremented */ @Test public void testCopyConsistencyWithInitialMostElements() { StorelessUnivariateStatistic master = (StorelessUnivariateStatistic) getUnivariateStatistic(); StorelessUnivariateStatistic replica = null; // select a portion of testArray till 75 % of the length to load first long index = FastMath.round(0.75 * testArray.length); // Put first half in master and copy master to replica master.incrementAll(testArray, 0, (int) index); replica = master.copy(); // Check same Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); // Now add second part to both and check again master.incrementAll(testArray, (int) index, (int) (testArray.length - index)); replica.incrementAll(testArray, (int) index, (int) (testArray.length - index)); Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); }
Example #3
Source File: PSquarePercentileTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Verifies that copied statistics remain equal to originals when * incremented the same way by way of copying original after just a few * elements are incremented */ @Test public void testCopyConsistencyWithInitialFirstFewElements() { StorelessUnivariateStatistic master = (StorelessUnivariateStatistic) getUnivariateStatistic(); StorelessUnivariateStatistic replica = null; // select a portion of testArray which is 10% of the length to load // first long index = FastMath.round(0.1 * testArray.length); // Put first half in master and copy master to replica master.incrementAll(testArray, 0, (int) index); replica = master.copy(); // Check same Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); // Now add second part to both and check again master.incrementAll(testArray, (int) index, (int) (testArray.length - index)); replica.incrementAll(testArray, (int) index, (int) (testArray.length - index)); Assert.assertTrue(master.equals(master)); Assert.assertTrue(replica.equals(replica)); Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); }
Example #4
Source File: PSquarePercentileTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Verifies that copied statistics remain equal to originals when * incremented the same way by way of copying original after just a few * elements are incremented */ @Test public void testCopyConsistencyWithInitialFirstFewElements() { StorelessUnivariateStatistic master = (StorelessUnivariateStatistic) getUnivariateStatistic(); StorelessUnivariateStatistic replica = null; // select a portion of testArray which is 10% of the length to load // first long index = FastMath.round(0.1 * testArray.length); // Put first half in master and copy master to replica master.incrementAll(testArray, 0, (int) index); replica = master.copy(); // Check same Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); // Now add second part to both and check again master.incrementAll(testArray, (int) index, (int) (testArray.length - index)); replica.incrementAll(testArray, (int) index, (int) (testArray.length - index)); Assert.assertTrue(master.equals(master)); Assert.assertTrue(replica.equals(replica)); Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); }
Example #5
Source File: PSquarePercentileTest.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Verifies that copied statistics remain equal to originals when * incremented the same way by making the copy after a majority of elements * are incremented */ @Test public void testCopyConsistencyWithInitialMostElements() { StorelessUnivariateStatistic master = (StorelessUnivariateStatistic) getUnivariateStatistic(); StorelessUnivariateStatistic replica = null; // select a portion of testArray till 75 % of the length to load first long index = FastMath.round(0.75 * testArray.length); // Put first half in master and copy master to replica master.incrementAll(testArray, 0, (int) index); replica = master.copy(); // Check same Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); // Now add second part to both and check again master.incrementAll(testArray, (int) index, (int) (testArray.length - index)); replica.incrementAll(testArray, (int) index, (int) (testArray.length - index)); Assert.assertTrue(replica.equals(master)); Assert.assertTrue(master.equals(replica)); }
Example #6
Source File: ProductTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(1, statistic.getResult(), 0); }
Example #7
Source File: Transforms.java From MeteoInfo with GNU Lesser General Public License v3.0 | 4 votes |
protected AbstractCumulativeFunction(final StorelessUnivariateStatistic stat, final Number initialValue) { this.stat = stat; this.initialValue = initialValue; reset(); }
Example #8
Source File: SumTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #9
Source File: SumSqTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #10
Source File: SumLogTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #11
Source File: ProductTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(1, statistic.getResult(), 0); }
Example #12
Source File: SumTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #13
Source File: SumSqTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #14
Source File: SumLogTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #15
Source File: ProductTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(1, statistic.getResult(), 0); }
Example #16
Source File: SumTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #17
Source File: SumSqTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #18
Source File: SumLogTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #19
Source File: ProductTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(1, statistic.getResult(), 0); }
Example #20
Source File: SumTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #21
Source File: SumSqTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #22
Source File: SumLogTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #23
Source File: ProductTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(1, statistic.getResult(), 0); }
Example #24
Source File: SumTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #25
Source File: Aggregation.java From joinery with GNU General Public License v3.0 | 4 votes |
protected AbstractStorelessStatistic(final StorelessUnivariateStatistic stat) { this.stat = stat; }
Example #26
Source File: Transforms.java From joinery with GNU General Public License v3.0 | 4 votes |
protected AbstractCumulativeFunction(final StorelessUnivariateStatistic stat, final Number initialValue) { this.stat = stat; this.initialValue = initialValue; reset(); }
Example #27
Source File: AggregateMathFunction.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 4 votes |
abstract public StorelessUnivariateStatistic createStatistic();
Example #28
Source File: SumSqTest.java From astor with GNU General Public License v2.0 | 4 votes |
@Override protected void checkClearValue(StorelessUnivariateStatistic statistic){ Assert.assertEquals(0, statistic.getResult(), 0); }
Example #29
Source File: Aggregation.java From MeteoInfo with GNU Lesser General Public License v3.0 | 4 votes |
protected AbstractStorelessStatistic(final StorelessUnivariateStatistic stat) { this.stat = stat; }
Example #30
Source File: NullStorelessUnivariateStatistic.java From january with Eclipse Public License 1.0 | 4 votes |
@Override public StorelessUnivariateStatistic copy() { return new NullStorelessUnivariateStatistic(); }