當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。