当前位置: 首页>>代码示例>>Java>>正文


Java DescriptiveStatistics.getSkewness方法代码示例

本文整理汇总了Java中org.apache.commons.math3.stat.descriptive.DescriptiveStatistics.getSkewness方法的典型用法代码示例。如果您正苦于以下问题:Java DescriptiveStatistics.getSkewness方法的具体用法?Java DescriptiveStatistics.getSkewness怎么用?Java DescriptiveStatistics.getSkewness使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math3.stat.descriptive.DescriptiveStatistics的用法示例。


在下文中一共展示了DescriptiveStatistics.getSkewness方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: collectData

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
public void collectData()
{
	collectPopulationData();

	List<DescriptiveStatistics> allTdata = collectMoreTolData();
	DescriptiveStatistics tolstats = allTdata.get(0);
	DescriptiveStatistics ntolstats = allTdata.get(1);
	DescriptiveStatistics mtolstats = allTdata.get(2);

	double morans = calculateMoransI(meanBlue);
	double moranTol = calculateMoransT(tolstats.getMean());
	mC = morans;
	mT = moranTol;
	//print("<<collectData>> morans is " + morans + ", moranTol is " + moranTol);
	String moranStr = "" + morans;
	String moranTolStr = "" + moranTol;
	String globalHappyStr = "" + globalHappiness;
	String globalBlueHappy = "" + globalHappinessB;
	String globalGreenHappy = "" + globalHappinessG;
	String numAgentStr = "" + allAgents.size();
	String totalMoveStr = String.valueOf(globalMoveCounter);
	String numblue = String.valueOf(population[0]);
	String numgreen = String.valueOf(population[1]);
	String changedMindStr = "" + changedMind;

	String tolN = "" + tolstats.getN();
	String tolmean = "" + tolstats.getMean();
	String tolvar = "" + tolstats.getVariance();
	String tolstdDev = "" + tolstats.getStandardDeviation();
	String tolKurt = "" + tolstats.getKurtosis();
	String tolSkew = "" + tolstats.getSkewness();

	String ntolN = "" + ntolstats.getN();
	String ntolmean = "" + ntolstats.getMean();
	String ntolvar = "" + ntolstats.getVariance();
	String ntolstdDev = "" + ntolstats.getStandardDeviation();
	String ntolKurt = "" + ntolstats.getKurtosis();
	String ntolSkew = "" + ntolstats.getSkewness();

	String mtolN = "" + mtolstats.getN();
	String mtolmean = "" + mtolstats.getMean();
	String mtolvar = "" + mtolstats.getVariance();
	String mtolstdDev = "" + mtolstats.getStandardDeviation();
	String mtolKurt = "" + mtolstats.getKurtosis();
	String mtolSkew = "" + mtolstats.getSkewness();

	String theString[] = null;

	theString = new String[] { moranStr, moranTolStr, totalMoveStr, globalHappyStr, globalBlueHappy, globalGreenHappy, numAgentStr, numblue, numgreen, changedMindStr, tolN, tolmean, tolvar,
			tolstdDev, tolKurt, tolSkew, ntolN, ntolmean, ntolvar, ntolstdDev, ntolKurt, ntolSkew, mtolN, mtolmean, mtolvar, mtolstdDev, mtolKurt, mtolSkew };

	writer.writeNext(theString);
}
 
开发者ID:lursel,项目名称:ABM-adaptive-tolerance,代码行数:54,代码来源:Simulation.java

示例2: process

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
@Override
public Data process(Data input) {
    Utils.isKeyValid(input, "NPIX", Integer.class);
    npix = (Integer) input.get("NPIX");

    int roi = (Integer) input.get("NROI");

    Utils.checkWindow(searchWindowLeft, searchWindowRight - searchWindowLeft, 0, roi);

    Utils.mapContainsKeys(input, dataKey);

    double[] data = (double[]) input.get(dataKey);

    double[] movingAverage;

    if (movingAverageKey != null) {
        movingAverage = (double[]) input.get(movingAverageKey);
    } else {
        movingAverage = new double[data.length];
    }


    double[] mean = new double[npix];
    double[] median = new double[npix];
    double[] mode = new double[npix];
    double[] std = new double[npix];
    double[] kurtosis = new double[npix];
    double[] skewness = new double[npix];
    double[] min = new double[npix];
    double[] max = new double[npix];
    double[] quantil25 = new double[npix];
    double[] quantil75 = new double[npix];

    for (int pix = 0; pix < npix; pix++) {
        double[] values = new double[searchWindowRight - searchWindowLeft];
        for (int sl = searchWindowLeft; sl < searchWindowRight; sl++) {
            int slice = pix * roi + sl;
            values[sl - searchWindowLeft] = data[slice];
            int binNumber = findBinNumber((data[slice] - movingAverage[slice]));
            histogram[binNumber] += 1;
        }
        DescriptiveStatistics stats = new DescriptiveStatistics(values);
        mean[pix] = stats.getMean();
        min[pix] = stats.getMin();
        max[pix] = stats.getMax();
        std[pix] = stats.getStandardDeviation();
        skewness[pix] = stats.getSkewness();
        kurtosis[pix] = stats.getKurtosis();

        Percentile percentile = new Percentile();
        median[pix] = percentile.evaluate(values, 0.5);
        quantil25[pix] = percentile.evaluate(values, 0.25);
        quantil75[pix] = percentile.evaluate(values, 0.75);

        double[] modeArray = StatUtils.mode(values);
        mode[pix] = modeArray[0];
    }

    input.put(outputKey + "_mean", mean);
    input.put(outputKey + "_median", median);
    input.put(outputKey + "_mode", mode);
    input.put(outputKey + "_std", std);
    input.put(outputKey + "_kurtosis", kurtosis);
    input.put(outputKey + "_skewness", skewness);
    input.put(outputKey + "_min", min);
    input.put(outputKey + "_max", max);
    input.put(outputKey + "_quantil25", quantil25);
    input.put(outputKey + "_quantil75", quantil75);
    input.put(outputKey + "_histogram", histogram);


    return input;
}
 
开发者ID:fact-project,项目名称:fact-tools,代码行数:74,代码来源:TimeseriesFeatures.java

示例3: process

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; //导入方法依赖的package包/类
@Override
public Data process(Data item) {
    Utils.isKeyValid(item, "NPIX", Integer.class);
    npix = (Integer) item.get("NPIX");

    Utils.mapContainsKeys(item, dataKey);

    int[][] data = (int[][]) item.get(dataKey);

    double[] mean = new double[npix];
    double[] median = new double[npix];
    double[] mode = new double[npix];
    double[] std = new double[npix];
    double[] kurtosis = new double[npix];
    double[] skewness = new double[npix];
    double[] min = new double[npix];
    double[] max = new double[npix];
    double[] quantil25 = new double[npix];
    double[] quantil75 = new double[npix];

    for (int pix = 0; pix < npix; pix++) {
        double[] values = Utils.toDoubleArray(data[pix]);


        ///FIXME: fill nans instead of continue
        if (values.length == 0) {
            continue;
        }

        DescriptiveStatistics stats = new DescriptiveStatistics(values);
        mean[pix] = stats.getMean();
        min[pix] = stats.getMin();
        max[pix] = stats.getMax();
        std[pix] = stats.getStandardDeviation();
        skewness[pix] = stats.getSkewness();
        kurtosis[pix] = stats.getKurtosis();
        quantil25[pix] = stats.getPercentile(0.25);
        quantil75[pix] = stats.getPercentile(0.75);
        median[pix] = stats.getPercentile(0.5);

        double[] modeArray = StatUtils.mode(values);
        mode[pix] = modeArray[0];
    }

    item.put(outputKey + "_mean", mean);
    item.put(outputKey + "_median", median);
    item.put(outputKey + "_mode", mode);
    item.put(outputKey + "_std", std);
    item.put(outputKey + "_kurtosis", kurtosis);
    item.put(outputKey + "_skewness", skewness);
    item.put(outputKey + "_min", min);
    item.put(outputKey + "_max", max);
    item.put(outputKey + "_quantil25", quantil25);
    item.put(outputKey + "_quantil75", quantil75);


    return item;
}
 
开发者ID:fact-project,项目名称:fact-tools,代码行数:59,代码来源:SinglePeStatisticsPixel.java


注:本文中的org.apache.commons.math3.stat.descriptive.DescriptiveStatistics.getSkewness方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。