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

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

Introduction

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

Prototype

double getMin();

Source Link

Document

Returns the minimum 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  w  w.  ja  v a2s .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/*  w  w  w . j a  v  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: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.//from   ww  w . j av a 2  s .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());
    }/*from  w ww . ja  va  2s.  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());/*w ww . j a  v  a  2  s  . co  m*/
    v.setMin(stats.getMin());
    v.setMean(stats.getMean());
    v.setCount(stats.getN());
    return v;
}