List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getMin
public double getMin()
From source file:com.github.jessemull.microflex.stat.statdouble.MinDoubleTest.java
/** * Tests the aggregated plate statistics method. *///from w w w. j a va 2 s. c o m @Test public void testAggregatedPlate() { for (PlateDouble plate : array) { List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(min.platesAggregated(plate), precision); for (WellDouble well : plate) { resultList.addAll(well.data()); } 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 = Precision.round(statAggregated.getMin(), precision); assertTrue(resultAggregated == aggregatedReturned); } }
From source file:com.github.jessemull.microflex.stat.statdouble.MinDoubleTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the collection./*from w w w. jav a2 s . com*/ */ @Test public void testAggregatedPlateCollectionIndices() { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); List<PlateDouble> collection = Arrays.asList(arrayIndices); Map<PlateDouble, Double> aggregatedReturnedMap = min.platesAggregated(collection, begin, end - begin); Map<PlateDouble, Double> aggregatedResultMap = new TreeMap<PlateDouble, Double>(); for (PlateDouble plate : collection) { List<Double> resultList = new ArrayList<Double>(); for (WellDouble well : plate) { resultList.addAll(well.data().subList(begin, end)); } 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.getMin(); aggregatedResultMap.put(plate, resultAggregated); } for (PlateDouble plate : collection) { double result = Precision.round(aggregatedResultMap.get(plate), precision); double returned = Precision.round(aggregatedReturnedMap.get(plate), precision); assertTrue(result == returned); } }
From source file:com.github.jessemull.microflex.stat.statdouble.MinDoubleTest.java
/** * Tests the aggregated plate statistics method. *//*from w w w . j a va 2 s . c o m*/ @Test public void testAggregatedSet() { for (PlateDouble plate : array) { List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(min.setsAggregated(plate.dataSet()), precision); for (WellDouble well : plate) { resultList.addAll(well.data()); } 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 = Precision.round(statAggregated.getMin(), precision); assertTrue(resultAggregated == aggregatedReturned); } }
From source file:com.github.jessemull.microflex.stat.statdouble.MinDoubleTest.java
/** * Tests the aggregated plate statistics method using a collection. *///from www . j a v a 2 s. c o m @Test public void testAggregatedSetCollection() { List<WellSetDouble> collection = new ArrayList<WellSetDouble>(); for (PlateDouble plate : array) { collection.add(plate.dataSet()); } Map<WellSetDouble, Double> aggregatedReturnedMap = min.setsAggregated(collection); Map<WellSetDouble, Double> aggregatedResultMap = new TreeMap<WellSetDouble, Double>(); for (WellSetDouble set : collection) { List<Double> resultList = new ArrayList<Double>(); for (WellDouble well : set) { resultList.addAll(well.data()); } 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 aggregatedResult = statAggregated.getMin(); aggregatedResultMap.put(set, aggregatedResult); } for (WellSetDouble set : collection) { double result = Precision.round(aggregatedResultMap.get(set), precision); double returned = Precision.round(aggregatedReturnedMap.get(set), precision); assertTrue(result == returned); } }
From source file:com.github.jessemull.microflex.stat.statinteger.MinIntegerTest.java
/** * Tests the aggregated plate statistics method using an array. *///from w w w.j a v a 2 s . c o m @Test public void testAggregatedSetArray() { WellSetInteger[] setArray = new WellSetInteger[array.length]; for (int i = 0; i < setArray.length; i++) { setArray[i] = array[i].dataSet(); } Map<WellSetInteger, Double> aggregatedReturnedMap = min.setsAggregated(setArray); Map<WellSetInteger, Double> aggregatedResultMap = new TreeMap<WellSetInteger, Double>(); for (WellSetInteger set : setArray) { List<Double> resultList = new ArrayList<Double>(); for (WellInteger well : set) { resultList.addAll(well.toDouble()); } 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 aggregatedResult = statAggregated.getMin(); aggregatedResultMap.put(set, aggregatedResult); } for (WellSetInteger set : setArray) { double result = Precision.round(aggregatedResultMap.get(set), precision); double returned = Precision.round(aggregatedReturnedMap.get(set), precision); assertTrue(result == returned); } }
From source file:com.github.jessemull.microflexdouble.stat.MinTest.java
/** * Tests the aggregated plate statistics method using an array. *//*w w w . j a v a 2 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, Double> aggregatedReturnedMap = min.setsAggregated(setArray); Map<WellSet, Double> aggregatedResultMap = new TreeMap<WellSet, Double>(); for (WellSet set : setArray) { List<Double> resultList = new ArrayList<Double>(); for (Well well : set) { resultList.addAll(well.data()); } 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 aggregatedResult = statAggregated.getMin(); aggregatedResultMap.put(set, aggregatedResult); } for (WellSet set : setArray) { double result = Precision.round(aggregatedResultMap.get(set), precision); double returned = Precision.round(aggregatedReturnedMap.get(set), precision); assertTrue(result == returned); } }
From source file:com.fpuna.preproceso.PreprocesoTS.java
private static void calculoFeatures(Registro[] muestras, String activity) { DescriptiveStatistics stats_x = new DescriptiveStatistics(); DescriptiveStatistics stats_y = new DescriptiveStatistics(); DescriptiveStatistics stats_z = new DescriptiveStatistics(); //DescriptiveStatistics stats_m1 = new DescriptiveStatistics(); //DescriptiveStatistics stats_m2 = new DescriptiveStatistics(); double[] fft_x; double[] fft_y; double[] fft_z; double[] AR_4; for (int i = 0; i < muestras.length; i++) { stats_x.addValue(muestras[i].getValor_x()); stats_y.addValue(muestras[i].getValor_y()); stats_z.addValue(muestras[i].getValor_z()); }//w w w . j a v a2 s . c o m //********* FFT ********* fft_x = Util.transform(stats_x.getValues()); fft_y = Util.transform(stats_y.getValues()); fft_z = Util.transform(stats_z.getValues()); //******************* Eje X *******************// //mean(s) - Arithmetic mean System.out.print(stats_x.getMean() + ","); //std(s) - Standard deviation System.out.print(stats_x.getStandardDeviation() + ","); //mad(s) - Median absolute deviation // //max(s) - Largest values in array System.out.print(stats_x.getMax() + ","); //min(s) - Smallest value in array System.out.print(stats_x.getMin() + ","); //skewness(s) - Frequency signal Skewness System.out.print(stats_x.getSkewness() + ","); //kurtosis(s) - Frequency signal Kurtosis System.out.print(stats_x.getKurtosis() + ","); //energy(s) - Average sum of the squares System.out.print(stats_x.getSumsq() / stats_x.getN() + ","); //entropy(s) - Signal Entropy System.out.print(Util.calculateShannonEntropy(fft_x) + ","); //iqr (s) Interquartile range System.out.print(stats_x.getPercentile(75) - stats_x.getPercentile(25) + ","); try { //autoregression (s) -4th order Burg Autoregression coefficients AR_4 = AutoRegression.calculateARCoefficients(stats_x.getValues(), 4, true); System.out.print(AR_4[0] + ","); System.out.print(AR_4[1] + ","); System.out.print(AR_4[2] + ","); System.out.print(AR_4[3] + ","); } catch (Exception ex) { Logger.getLogger(PreprocesoTS.class.getName()).log(Level.SEVERE, null, ex); } //meanFreq(s) - Frequency signal weighted average System.out.print(Util.meanFreq(fft_x, stats_x.getValues()) + ","); //******************* Eje Y *******************// //mean(s) - Arithmetic mean System.out.print(stats_y.getMean() + ","); //std(s) - Standard deviation System.out.print(stats_y.getStandardDeviation() + ","); //mad(s) - Median absolute deviation // //max(s) - Largest values in array System.out.print(stats_y.getMax() + ","); //min(s) - Smallest value in array System.out.print(stats_y.getMin() + ","); //skewness(s) - Frequency signal Skewness System.out.print(stats_y.getSkewness() + ","); //kurtosis(s) - Frequency signal Kurtosis System.out.print(stats_y.getKurtosis() + ","); //energy(s) - Average sum of the squares System.out.print(stats_y.getSumsq() / stats_y.getN() + ","); //entropy(s) - Signal Entropy System.out.print(Util.calculateShannonEntropy(fft_y) + ","); //iqr (s) Interquartile range System.out.print(stats_y.getPercentile(75) - stats_y.getPercentile(25) + ","); try { //autoregression (s) -4th order Burg Autoregression coefficients AR_4 = AutoRegression.calculateARCoefficients(stats_y.getValues(), 4, true); System.out.print(AR_4[0] + ","); System.out.print(AR_4[1] + ","); System.out.print(AR_4[2] + ","); System.out.print(AR_4[3] + ","); } catch (Exception ex) { Logger.getLogger(PreprocesoTS.class.getName()).log(Level.SEVERE, null, ex); } //meanFreq(s) - Frequency signal weighted average System.out.print(Util.meanFreq(fft_y, stats_y.getValues()) + ","); //******************* Eje Z *******************// //mean(s) - Arithmetic mean System.out.print(stats_z.getMean() + ","); //std(s) - Standard deviation System.out.print(stats_z.getStandardDeviation() + ","); //mad(s) - Median absolute deviation // //max(s) - Largest values in array System.out.print(stats_z.getMax() + ","); //min(s) - Smallest value in array System.out.print(stats_z.getMin() + ","); //skewness(s) - Frequency signal Skewness System.out.print(stats_z.getSkewness() + ","); //kurtosis(s) - Frequency signal Kurtosis System.out.print(stats_z.getKurtosis() + ","); //energy(s) - Average sum of the squares System.out.print(stats_z.getSumsq() / stats_z.getN() + ","); //entropy(s) - Signal Entropy System.out.print(Util.calculateShannonEntropy(fft_z) + ","); //iqr (s) Interquartile range System.out.print(stats_z.getPercentile(75) - stats_z.getPercentile(25) + ","); try { //autoregression (s) -4th order Burg Autoregression coefficients AR_4 = AutoRegression.calculateARCoefficients(stats_z.getValues(), 4, true); System.out.print(AR_4[0] + ","); System.out.print(AR_4[1] + ","); System.out.print(AR_4[2] + ","); System.out.print(AR_4[3] + ","); } catch (Exception ex) { Logger.getLogger(PreprocesoTS.class.getName()).log(Level.SEVERE, null, ex); } //meanFreq(s) - Frequency signal weighted average System.out.print(Util.meanFreq(fft_z, stats_z.getValues()) + ","); //******************* Feature combinados *******************/ //sma(s1; s2; s3) - Signal magnitude area System.out.print(Util.sma(stats_x.getValues(), stats_y.getValues(), stats_z.getValues()) + ","); //correlation(s1; s2) - Pearson Correlation coefficient System.out.print(new PearsonsCorrelation().correlation(stats_x.getValues(), stats_y.getValues()) + ","); System.out.print(new PearsonsCorrelation().correlation(stats_x.getValues(), stats_z.getValues()) + ","); System.out.print(new PearsonsCorrelation().correlation(stats_y.getValues(), stats_z.getValues()) + ","); //******************* Actividad *******************/ System.out.print(activity); System.out.print("\n"); }
From source file:com.github.jessemull.microflex.stat.statdouble.MinDoubleTest.java
/** * Tests the aggregated plate statistics method using an array. *//*w w w.j a va 2 s.co m*/ @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, Double> aggregatedReturnedMap = min.setsAggregated(setArray); Map<WellSetDouble, Double> aggregatedResultMap = new TreeMap<WellSetDouble, Double>(); for (WellSetDouble set : setArray) { List<Double> resultList = new ArrayList<Double>(); for (WellDouble well : set) { resultList.addAll(well.data()); } 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 aggregatedResult = statAggregated.getMin(); aggregatedResultMap.put(set, aggregatedResult); } for (WellSetDouble set : setArray) { double result = Precision.round(aggregatedResultMap.get(set), precision); double returned = Precision.round(aggregatedReturnedMap.get(set), precision); assertTrue(result == returned); } }
From source file:com.github.jessemull.microflexinteger.stat.MinTest.java
/** * Tests the aggregated plate statistics method using the values between the indices. *//*ww w. j a va 2 s.c o m*/ @Test public void testAggregatedPlateIndices() { for (Plate plate : arrayIndices) { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); List<Double> resultList = new ArrayList<Double>(); double aggregatedReturned = Precision.round(min.platesAggregated(plate, begin, end - begin), precision); for (Well well : plate) { resultList.addAll(well.toDouble().subList(begin, end)); } 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 aggregatedResult = Precision.round(statAggregated.getMin(), precision); assertTrue(aggregatedResult == aggregatedReturned); } }
From source file:com.github.jessemull.microflexinteger.stat.MinTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the collection./* ww w .ja v a 2s .co m*/ */ @Test public void testAggregatedSetCollectionIndices() { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); List<WellSet> collection = new ArrayList<WellSet>(); for (Plate plate : arrayIndices) { collection.add(plate.dataSet()); } Map<WellSet, Double> aggregatedReturnedMap = min.setsAggregated(collection, begin, end - begin); Map<WellSet, Double> aggregatedResultMap = new TreeMap<WellSet, Double>(); for (WellSet set : collection) { List<Double> resultList = new ArrayList<Double>(); for (Well well : set) { resultList.addAll(well.toDouble().subList(begin, end)); } 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 aggregatedResult = statAggregated.getMin(); aggregatedResultMap.put(set, aggregatedResult); } for (WellSet set : collection) { double result = Precision.round(aggregatedResultMap.get(set), precision); double returned = Precision.round(aggregatedReturnedMap.get(set), precision); assertTrue(result == returned); } }