Example usage for org.apache.commons.math3.stat.descriptive StatisticalSummary getMax

List of usage examples for org.apache.commons.math3.stat.descriptive StatisticalSummary getMax

Introduction

In this page you can find the example usage for org.apache.commons.math3.stat.descriptive StatisticalSummary getMax.

Prototype

double getMax();

Source Link

Document

Returns the maximum of the available values

Usage

From source file:joinery.impl.Aggregation.java

@SuppressWarnings("unchecked")
public static <V> DataFrame<V> describe(final DataFrame<V> df) {
    final DataFrame<V> desc = new DataFrame<>();
    for (final Object col : df.columns()) {
        for (final Object row : df.index()) {
            final V value = df.get(row, col);
            if (value instanceof StatisticalSummary) {
                if (!desc.columns().contains(col)) {
                    desc.add(col);/* w ww . j  a  v  a 2s . c o m*/
                    if (desc.isEmpty()) {
                        for (final Object r : df.index()) {
                            for (final Object stat : Arrays.asList("count", "mean", "std", "var", "max",
                                    "min")) {
                                final Object name = name(df, r, stat);
                                desc.append(name, Collections.<V>emptyList());
                            }
                        }
                    }
                }

                final StatisticalSummary summary = StatisticalSummary.class.cast(value);
                desc.set(name(df, row, "count"), col, (V) new Double(summary.getN()));
                desc.set(name(df, row, "mean"), col, (V) new Double(summary.getMean()));
                desc.set(name(df, row, "std"), col, (V) new Double(summary.getStandardDeviation()));
                desc.set(name(df, row, "var"), col, (V) new Double(summary.getVariance()));
                desc.set(name(df, row, "max"), col, (V) new Double(summary.getMax()));
                desc.set(name(df, row, "min"), col, (V) new Double(summary.getMin()));
            }
        }
    }
    return desc;
}

From source file:be.ugent.maf.cellmissy.gui.view.table.model.SingleCellStatSummaryTableModel.java

/**
 * Initialize table/*from  w ww. j  av  a 2s.com*/
 */
private void initTable() {
    // list of summaries from the analysis group: number of rows
    List<StatisticalSummary> statisticalSummaries = singleCellAnalysisGroup.getStatisticalSummaries();
    int size = statisticalSummaries.size();
    // columns: 1 + 6 for statistical numbers
    columnNames = new String[7];
    columnNames[0] = "";
    columnNames[1] = "Max";
    columnNames[2] = "Min";
    columnNames[3] = "Mean";
    columnNames[4] = "N";
    columnNames[5] = "SD";
    columnNames[6] = "Variance";
    singleCellAnalysisGroup.getConditionDataHolders();
    data = new Object[size][columnNames.length];
    // fill in data
    for (int rowIndex = 0; rowIndex < data.length; rowIndex++) {
        data[rowIndex][0] = "Cond "
                + (singleCellAnalysisGroup.getConditionDataHolders().get(rowIndex).getPlateCondition());
        // summary for a row
        StatisticalSummary statisticalSummary = statisticalSummaries.get(rowIndex);
        // distribute statistical objects per columns
        data[rowIndex][1] = statisticalSummary.getMax();
        data[rowIndex][2] = statisticalSummary.getMin();
        data[rowIndex][3] = statisticalSummary.getMean();
        data[rowIndex][4] = statisticalSummary.getN();
        data[rowIndex][5] = statisticalSummary.getStandardDeviation();
        data[rowIndex][6] = statisticalSummary.getVariance();

    }
}

From source file:ijfx.core.stats.DefaultImageStatisticsService.java

@Override
public Map<String, Double> summaryStatisticsToMap(StatisticalSummary summaryStats) {

    Map<String, Double> statistics = new HashMap<>();
    statistics.put(LBL_MEAN, summaryStats.getMean());
    statistics.put(LBL_MIN, summaryStats.getMin());
    statistics.put(LBL_MAX, summaryStats.getMax());
    statistics.put(LBL_SD, summaryStats.getStandardDeviation());
    statistics.put(LBL_VARIANCE, summaryStats.getVariance());
    statistics.put(LBL_PIXEL_COUNT, (double) summaryStats.getN());
    return statistics;
}

From source file:com.isentropy.accumulo.test.AccumuloMapTest.java

public void testMultiMap(Connector c, int maxValues)
        throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
    AccumuloSortedMap<Number, Number> mm = new AccumuloSortedMap(c, Util.randomHexString(10));
    mm.setMaxValuesPerKey(maxValues);/*from  ww w .  ja  v a  2s  .  c  o  m*/
    assertTrue(mm.getMaxValuesPerKey() == maxValues);
    System.out.println("mm.getMultiMapMaxValues() == " + mm.getMaxValuesPerKey());
    mm.put(1, 2);
    mm.put(1, 3);
    mm.put(1, 4);
    mm.put(2, 22);
    StatisticalSummary row1 = mm.rowStats().get(1);
    assertTrue(row1.getMean() == 3.0);
    assertTrue(row1.getMax() == 4.0);
    // size should reflect # keys
    assertTrue(mm.size() == 2);
    // count multiple values
    assertTrue(mm.sizeAsLong(true) == 4);
    //4 +22
    assertTrue(mm.valueStats().getSum() == 26);
    //2+3+4+22
    StatisticalSummary stats = mm.valueStats(true);
    double sum = stats.getSum();
    assertTrue(mm.valueStats(true).getSum() == 31);

}

From source file:org.briljantframework.data.dataframe.DataFrames.java

/**
 * Presents a summary of the given data frame. For each column of {@code df} the returned summary
 * contains one row. Each row is described by four values, the {@code min}, {@code max},
 * {@code mean} and {@code mode}. The first three are presented for numerical columns and the
 * fourth for categorical.//  ww  w .java2s.  co m
 *
 * <pre>
 * {@code
 * > DataFrame df = MixedDataFrame.of(
 *    "a", Vector.of(1, 2, 3, 4, 5, 6),
 *    "b", Vector.of("a", "b", "b", "b", "e", "f"),
 *    "c", Vector.of(1.1, 1.2, 1.3, 1.4, 1.5, 1.6)
 *  );
 * 
 * > DataFrames.summary(df)
 *    mean   var    std    min    max    mode
 * a  3.500  3.500  1.871  1.000  6.000  6
 * b  NA     NA     NA     NA     NA     f
 * c  1.350  0.035  0.187  1.100  1.600  1.1
 * 
 * [3 rows x 6 columns]
 * }
 * </pre>
 *
 * @param df the data frame
 * @return a data frame summarizing {@code df}
 */
public static DataFrame summary(DataFrame df) {
    DataFrame.Builder builder = new MixedDataFrame.Builder();
    builder.set("mean", VectorType.DOUBLE).set("var", VectorType.DOUBLE).set("std", VectorType.DOUBLE)
            .set("min", VectorType.DOUBLE).set("max", VectorType.DOUBLE).set("mode", VectorType.OBJECT);

    for (Object columnKey : df.getColumnIndex().keySet()) {
        Vector column = df.get(columnKey);
        if (Is.numeric(column)) {
            StatisticalSummary summary = column.collect(Number.class, Collectors.statisticalSummary());
            builder.set(columnKey, "mean", summary.getMean()).set(columnKey, "var", summary.getVariance())
                    .set(columnKey, "std", summary.getStandardDeviation())
                    .set(columnKey, "min", summary.getMin()).set(columnKey, "max", summary.getMax());
        }
        builder.set(columnKey, "mode", column.collect(Collectors.mode()));
    }
    return builder.build();
}

From source file:org.briljantframework.data.dataframe.transform.MinMaxNormalizer.java

@Override
public Transformer fit(DataFrame df) {
    Vector.Builder min = Vector.Builder.of(Double.class);
    Vector.Builder max = Vector.Builder.of(Double.class);
    for (Object columnKey : df) {
        // // TODO: 11/14/15 Only consider numerical vectors
        StatisticalSummary summary = df.get(columnKey).statisticalSummary();
        min.set(columnKey, summary.getMin());
        max.set(columnKey, summary.getMax());
    }/*w  w w.j  a va2 s .  c  o m*/

    return new MinMaxNormalizeTransformer(max.build(), min.build());
}

From source file:org.italiangrid.voms.aa.x509.stats.ExecutionTimeStats.java

public static ExecutionTimeStats fromSummaryStats(StatisticalSummary stats) {

    ExecutionTimeStats v = new ExecutionTimeStats();

    v.setMax(stats.getMax());
    v.setMin(stats.getMin());//  w  w  w  .  j ava  2s.  c o m
    v.setMean(stats.getMean());
    v.setCount(stats.getN());
    return v;
}