List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getN
public long getN()
From source file:com.github.jessemull.microflex.stat.statbigdecimal.NBigDecimalTest.java
/** * Tests the aggregated plate statistics method using a collection. *//* w ww .ja v a2s. c o m*/ @Test public void testAggregatedSetCollection() { List<WellSetBigDecimal> collection = new ArrayList<WellSetBigDecimal>(); for (PlateBigDecimal plate : array) { collection.add(plate.dataSet()); } Map<WellSetBigDecimal, Integer> aggregatedReturnedMap = n.setsAggregated(collection); Map<WellSetBigDecimal, Integer> aggregatedResultMap = new TreeMap<WellSetBigDecimal, Integer>(); for (WellSetBigDecimal set : collection) { List<Double> resultList = new ArrayList<Double>(); for (WellBigDecimal well : set) { for (BigDecimal bd : well) { resultList.add(bd.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSetBigDecimal set : collection) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.NBigIntegerTest.java
/** * Tests the aggregated plate statistics method using a collection. *//*from w ww. j a va 2 s .c o m*/ @Test public void testAggregatedSetCollection() { List<WellSetBigInteger> collection = new ArrayList<WellSetBigInteger>(); for (PlateBigInteger plate : array) { collection.add(plate.dataSet()); } Map<WellSetBigInteger, Integer> aggregatedReturnedMap = n.setsAggregated(collection); Map<WellSetBigInteger, Integer> aggregatedResultMap = new TreeMap<WellSetBigInteger, Integer>(); for (WellSetBigInteger set : collection) { List<Double> resultList = new ArrayList<Double>(); for (WellBigInteger well : set) { for (BigInteger bi : well) { resultList.add(bi.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSetBigInteger set : collection) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflex.stat.statdouble.NDoubleTest.java
/** * Tests the aggregated plate statistics method using an array. *///from w ww .j a va 2 s . com @Test public void testAggregatedSetArray() { WellSetDouble[] setArray = new WellSetDouble[array.length]; for (int i = 0; i < setArray.length; i++) { setArray[i] = array[i].dataSet(); } Map<WellSetDouble, Integer> aggregatedReturnedMap = n.setsAggregated(setArray); Map<WellSetDouble, Integer> aggregatedResultMap = new TreeMap<WellSetDouble, Integer>(); for (WellSetDouble set : setArray) { List<Double> resultList = new ArrayList<Double>(); for (WellDouble well : set) { for (double db : well) { resultList.add(db); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSetDouble set : setArray) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.NTest.java
/** * Tests the aggregated plate statistics method using a collection. *//* w w w .j av a 2 s .c o m*/ @Test public void testAggregatedSetCollection() { List<WellSet> collection = new ArrayList<WellSet>(); for (Plate plate : array) { collection.add(plate.dataSet()); } Map<WellSet, Integer> aggregatedReturnedMap = n.setsAggregated(collection); Map<WellSet, Integer> aggregatedResultMap = new TreeMap<WellSet, Integer>(); for (WellSet set : collection) { List<Double> resultList = new ArrayList<Double>(); for (Well well : set) { for (BigDecimal bd : well) { resultList.add(bd.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSet set : collection) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflexbiginteger.stat.NTest.java
/** * Tests the aggregated plate statistics method using a collection. *//*from w w w . j av a 2 s.co m*/ @Test public void testAggregatedSetCollection() { List<WellSet> collection = new ArrayList<WellSet>(); for (Plate plate : array) { collection.add(plate.dataSet()); } Map<WellSet, Integer> aggregatedReturnedMap = n.setsAggregated(collection); Map<WellSet, Integer> aggregatedResultMap = new TreeMap<WellSet, Integer>(); for (WellSet set : collection) { List<Double> resultList = new ArrayList<Double>(); for (Well well : set) { for (BigInteger bi : well) { resultList.add(bi.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSet set : collection) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.NBigDecimalTest.java
/** * Tests the aggregated plate statistics method using an array. *//*from www .j a v a 2s. c o m*/ @Test public void testAggregatedSetArray() { WellSetBigDecimal[] setArray = new WellSetBigDecimal[array.length]; for (int i = 0; i < setArray.length; i++) { setArray[i] = array[i].dataSet(); } Map<WellSetBigDecimal, Integer> aggregatedReturnedMap = n.setsAggregated(setArray); Map<WellSetBigDecimal, Integer> aggregatedResultMap = new TreeMap<WellSetBigDecimal, Integer>(); for (WellSetBigDecimal set : setArray) { List<Double> resultList = new ArrayList<Double>(); for (WellBigDecimal well : set) { for (BigDecimal bd : well) { resultList.add(bd.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSetBigDecimal set : setArray) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.NBigIntegerTest.java
/** * Tests the aggregated plate statistics method using an array. *///from ww w . ja v a 2 s . c om @Test public void testAggregatedSetArray() { WellSetBigInteger[] setArray = new WellSetBigInteger[array.length]; for (int i = 0; i < setArray.length; i++) { setArray[i] = array[i].dataSet(); } Map<WellSetBigInteger, Integer> aggregatedReturnedMap = n.setsAggregated(setArray); Map<WellSetBigInteger, Integer> aggregatedResultMap = new TreeMap<WellSetBigInteger, Integer>(); for (WellSetBigInteger set : setArray) { List<Double> resultList = new ArrayList<Double>(); for (WellBigInteger well : set) { for (BigInteger bi : well) { resultList.add(bi.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSetBigInteger set : setArray) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.NTest.java
/** * Tests the aggregated plate statistics method using an array. *//*from w w w . j ava 2s . c om*/ @Test public void testAggregatedSetArray() { WellSet[] setArray = new WellSet[array.length]; for (int i = 0; i < setArray.length; i++) { setArray[i] = array[i].dataSet(); } Map<WellSet, Integer> aggregatedReturnedMap = n.setsAggregated(setArray); Map<WellSet, Integer> aggregatedResultMap = new TreeMap<WellSet, Integer>(); for (WellSet set : setArray) { List<Double> resultList = new ArrayList<Double>(); for (Well well : set) { for (BigDecimal bd : well) { resultList.add(bd.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSet set : setArray) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflexbiginteger.stat.NTest.java
/** * Tests the aggregated plate statistics method using an array. *//*from www . j a va2 s .c o m*/ @Test public void testAggregatedSetArray() { WellSet[] setArray = new WellSet[array.length]; for (int i = 0; i < setArray.length; i++) { setArray[i] = array[i].dataSet(); } Map<WellSet, Integer> aggregatedReturnedMap = n.setsAggregated(setArray); Map<WellSet, Integer> aggregatedResultMap = new TreeMap<WellSet, Integer>(); for (WellSet set : setArray) { List<Double> resultList = new ArrayList<Double>(); for (Well well : set) { for (BigInteger bi : well) { resultList.add(bi.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSet set : setArray) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }
From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.analysis.diagnostics.LinePlot.java
/** * Generates the quantile series for the specified key. * //from w w w.j a v a 2 s .c om * @param key the key identifying which result to plot * @param dataset the dataset to store the generated series */ protected void generateQuantileSeries(ResultKey key, YIntervalSeriesCollection dataset) { List<DataPoint> dataPoints = new ArrayList<DataPoint>(); for (Accumulator accumulator : controller.get(key)) { if (!accumulator.keySet().contains(metric)) { continue; } for (int i = 0; i < accumulator.size(metric); i++) { dataPoints.add(new DataPoint((Integer) accumulator.get("NFE", i), ((Number) accumulator.get(metric, i)).doubleValue())); } } Collections.sort(dataPoints); YIntervalSeries series = new YIntervalSeries(key); DescriptiveStatistics statistics = new DescriptiveStatistics(); int index = 0; int currentNFE = RESOLUTION; while (index < dataPoints.size()) { DataPoint point = dataPoints.get(index); if (point.getNFE() <= currentNFE) { statistics.addValue(point.getValue()); index++; } else { if (statistics.getN() > 0) { series.add(currentNFE, statistics.getPercentile(50), statistics.getPercentile(25), statistics.getPercentile(75)); } statistics.clear(); currentNFE += RESOLUTION; } } if (statistics.getN() > 0) { //if only entry, add extra point to display non-zero width if (series.isEmpty()) { series.add(currentNFE - RESOLUTION, statistics.getPercentile(50), statistics.getPercentile(25), statistics.getPercentile(75)); } series.add(currentNFE, statistics.getPercentile(50), statistics.getPercentile(25), statistics.getPercentile(75)); } dataset.addSeries(series); }