List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getMean
public double getMean()
From source file:com.github.jessemull.microflexdouble.stat.MeanTest.java
/** * Tests well calculation.//from w w w .j a v a 2 s .c o m */ @Test public void testWell() { for (Plate plate : array) { for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (double bd : well) { input[index++] = bd; ; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = Precision.round(stat.getMean(), precision); double returned = Precision.round(mean.well(well), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statdouble.MeanDoubleTest.java
/** * Tests well calculation./*from ww w. ja v a 2 s. c o m*/ */ @Test public void testWell() { for (PlateDouble plate : array) { for (WellDouble well : plate) { double[] input = new double[well.size()]; int index = 0; for (double bd : well) { input[index++] = bd; ; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = Precision.round(stat.getMean(), precision); double returned = Precision.round(mean.well(well), precision); assertTrue(result == returned); } } }
From source file:com.github.jessemull.microflex.stat.statinteger.MeanIntegerTest.java
/** * Tests well calculation.// w w w . ja v a2s . co m */ @Test public void testWell() { for (PlateInteger plate : array) { for (WellInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (double bd : well) { input[index++] = bd; ; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = Precision.round(stat.getMean(), precision); double returned = Precision.round(mean.well(well), precision); assertTrue(result == returned); } } }
From source file:classifiers.ComplexClassifierZufall.java
@Override public void BewertunginProzent() throws Exception { /* if (Model.getAnzahlkanten() != 0) { System.out.println("Parameter:" + "Vernetzungsprozent:" + this.vernetzung + "(" + (Model.getMoeglischeAnzahlKanten() * vernetzung) / Model.getAnzahlkanten() + ")," + " " + "Anzahldurchlauf:" + this.anzahldurchlauf + " " + "max Anzahlkanten:" + Model.getAnzahlkanten() + "(" + Model.getMoeglischeAnzahlKanten() + " )"); } else {/*from w w w . jav a 2s. c om*/ System.out.println("Parameter:" + "Vernetzungsprozent:" + this.vernetzung + "(" + (Model.getMoeglischeAnzahlKanten() * vernetzung) + ")," + " " + "Anzahldurchlauf:" + this.anzahldurchlauf + " " + "max Anzahlkanten:" + Model.getAnzahlkanten() + "(" + Model.getMoeglischeAnzahlKanten() + " )"); } System.out.println("----------------------------------------------------------------------------------------");*/ double count = 0; double[][] bestergeb = new double[1][2]; double max = 100; double[][] hilf; double[][] hilf2; double[] erg = new double[5]; for (int i = 0; i < anzahldurchlauf; i++) { Bootstrap(Modelmenge); train(this.traindaten); // System.out.println("training NR" + " " + i + ":"); // System.out.println("trainingsdeaten:"); hilf = new double[1][2]; hilf2 = new double[1][2]; hilf = test(traindaten); this.trainergebnisse[i][0] = hilf[0][0]; this.trainergebnisse[i][1] = hilf[0][1]; // System.out.println("Fehlerquote TrainingNR" + " " + i + ":" + " " + (double) (int) (this.trainergebnisse[i][0] * 100) / 100 + "%" + " " + "Dauer:" + " " + (int) (this.trainergebnisse[i][1]) + "ms"); hilf2 = test(testdaten); this.testergebnisse[i][0] = hilf2[0][0]; this.testergebnisse[i][1] = hilf2[0][1]; /* if(testergebnisse[i][0]<=max) { max=testergebnisse[i][0]; bestemodel=Model; bestergeb[0][0]=testergebnisse[i][0]; bestergeb[0][1]=testergebnisse[i][1]; }*/ //System.out.println("Validierung NR" + " " + i + ":"); //System.out.println("Validierungsngsdaten:"); // System.out.println("Fehlerquote Validierungs NR" + " " + i + ":" + " " + (double) (int) (this.testergebnisse[i][0] * 100) / 100 + "%" + " " + "Dauer:" + " " + (int) (this.testergebnisse[i][1]) + "ms"); //System.out.println("----------------------------------------------------------------------------------------"); } DescriptiveStatistics stats1 = new DescriptiveStatistics(); DescriptiveStatistics stat1 = new DescriptiveStatistics(); // Add the data from the array for (int i = 0; i < trainergebnisse.length; i++) { stats1.addValue(trainergebnisse[i][0]); stat1.addValue(trainergebnisse[i][1]); } double mean1 = stats1.getMean(); double std1 = stats1.getStandardDeviation(); double meanzeit1 = stat1.getMean(); double stdzeit1 = stat1.getStandardDeviation(); // System.out.println("Mittlere Felehrquote des Tainings:" + " " + (double) (int) (mean1 * 100) / 100 + "%" + "(" + (double) (int) ((std1 / Math.sqrt(anzahldurchlauf)) * 100) / 100 + "%)"); //System.out.println("Mittlere Dauer des trainings:" + " " + (int) (meanzeit1) + " " + "ms" + "(" + (int) ((stdzeit1 / Math.sqrt(anzahldurchlauf))) + "ms)"); //System.out.println("--------------------------------------------------------------------------------------"); DescriptiveStatistics stats = new DescriptiveStatistics(); DescriptiveStatistics stat = new DescriptiveStatistics(); // Add the data from the array for (int i = 0; i < testergebnisse.length; i++) { stats.addValue(testergebnisse[i][0]); stat.addValue(testergebnisse[i][1]); } this.Mittlerevalidierungsquote = stats.getMean(); this.stadartdeviationvalidierung = (int) (stats.getStandardDeviation() / Math.sqrt(anzahldurchlauf)); this.Mittlerezeit = stat.getMean(); this.standartdeviationtime = (int) (stat.getStandardDeviation() / Math.sqrt(anzahldurchlauf)); // System.out.println("Mittlere Fehlerquote der Validierungsmengen:" + " " + (double) (int) (Mittlerevalidierungsquote * 100) / 100 + "%" + "(" + (double) (int) ((stadartdeviationvalidierung / Math.sqrt(anzahldurchlauf)) * 100) / 100 + "%)"); //System.out.println("Mittlere Dauer der Validierung :" + " " + (int) (Mittlerezeit) + " " + "ms" + "(" + (int) ((standartdeviationtime / Math.sqrt(anzahldurchlauf))) + "ms)"); erg[0] = vernetzung; erg[1] = (double) (int) (Mittlerevalidierungsquote * 100) / 100; erg[2] = Mittlerezeit; erg[3] = (double) (int) ((stadartdeviationvalidierung / Math.sqrt(anzahldurchlauf)) * 100) / 100; erg[4] = (int) ((standartdeviationtime / Math.sqrt(anzahldurchlauf))); train(this.Modelmenge); hilf = test(Modelmenge); this.Modelergebnisse[0][0] = hilf[0][0]; this.Modelergebnisse[0][1] = hilf[0][1]; hilf = test(validierungsmenge); validierungsergebnisse[0][0] = hilf[0][0]; validierungsergebnisse[0][1] = hilf[0][1]; struct.setErgebnisse(erg); /* System.out.println("---------------------------------------------------------------------------------------");*/ ///System.out.println("Fehlerquote der training auf dem Datensatz:" + " " + (double) (int) (Modelergebnisse[0][0] * 100) / 100 + "%"); //System.out.println("Zeit des trainings (Datensatz):" + " " + (int) (Modelergebnisse[0][1]) + " " + "ms"); //System.out.println("---------------------------------------------------------------------------------------"); //System.out.println("Fehlerquote der Test:" + " " + (double) (int) (validierungsergebnisse[0][0] * 100) / 100 + "%"); // System.out.println("Zeit der Test:" + " " + (int) (validierungsergebnisse[0][1]) + " " + "ms"); /* System.out.println(); System.out.println("Beste Struktur:"+" "+"Validierung:"+" "+(int)bestergeb[0][0]+"%"+" "+"Zeit:"+" "+(int)bestergeb[0][1]+"ms"); System.out.println("---------------------------------------------------------------------------------------"); bestemodel=Model; if(bestemodel!=null) bestemodel.ToString();*/ }
From source file:com.github.jessemull.microflexinteger.stat.MeanTest.java
/** * Tests the aggregated plate statistics method using a collection. *///from www . j a va 2 s . c om @Test public void testAggregatedPlateCollection() { List<Plate> collection = Arrays.asList(array); Map<Plate, Double> aggregatedReturnedMap = mean.platesAggregated(collection); Map<Plate, Double> aggregatedResultMap = new TreeMap<Plate, Double>(); for (Plate plate : collection) { List<Double> resultList = new ArrayList<Double>(); for (Well well : plate) { 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.getMean(); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate 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.microflexinteger.stat.MeanTest.java
/** * Tests the aggregated plate statistics method using an array. *///from w w w . j a v a2 s . co m @Test public void testAggregatedPlateArray() { Map<Plate, Double> aggregatedReturnedMap = mean.platesAggregated(array); Map<Plate, Double> aggregatedResultMap = new TreeMap<Plate, Double>(); for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); for (Well well : plate) { 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.getMean(); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate plate : array) { 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.microflexdouble.stat.MeanTest.java
/** * Tests the aggregated plate statistics method using a collection. *//*from w w w .j av a 2 s.co m*/ @Test public void testAggregatedPlateCollection() { List<Plate> collection = Arrays.asList(array); Map<Plate, Double> aggregatedReturnedMap = mean.platesAggregated(collection); Map<Plate, Double> aggregatedResultMap = new TreeMap<Plate, Double>(); for (Plate plate : collection) { List<Double> resultList = new ArrayList<Double>(); for (Well 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 aggregatedResult = statAggregated.getMean(); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate 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.microflexdouble.stat.MeanTest.java
/** * Tests the aggregated plate statistics method using an array. *///from ww w . j av a2s .c o m @Test public void testAggregatedPlateArray() { Map<Plate, Double> aggregatedReturnedMap = mean.platesAggregated(array); Map<Plate, Double> aggregatedResultMap = new TreeMap<Plate, Double>(); for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); for (Well 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 aggregatedResult = statAggregated.getMean(); aggregatedResultMap.put(plate, aggregatedResult); } for (Plate plate : array) { 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.MeanDoubleTest.java
/** * Tests the aggregated plate statistics method using a collection. *//*ww w . j a v a2 s .c o m*/ @Test public void testAggregatedPlateCollection() { List<PlateDouble> collection = Arrays.asList(array); Map<PlateDouble, Double> aggregatedReturnedMap = mean.platesAggregated(collection); 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()); } 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.getMean(); aggregatedResultMap.put(plate, aggregatedResult); } 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.MeanDoubleTest.java
/** * Tests the aggregated plate statistics method using an array. */// w ww.jav a2 s. c om @Test public void testAggregatedPlateArray() { Map<PlateDouble, Double> aggregatedReturnedMap = mean.platesAggregated(array); Map<PlateDouble, Double> aggregatedResultMap = new TreeMap<PlateDouble, Double>(); for (PlateDouble plate : array) { List<Double> resultList = new ArrayList<Double>(); 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 aggregatedResult = statAggregated.getMean(); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateDouble plate : array) { double result = Precision.round(aggregatedResultMap.get(plate), precision); double returned = Precision.round(aggregatedReturnedMap.get(plate), precision); assertTrue(result == returned); } }