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


Java KolmogorovSmirnovTest.kolmogorovSmirnovTest方法代码示例

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


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

示例1: testDifference

import org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest; //导入方法依赖的package包/类
/**
 * Test if two clusters are significantly different in the metrics we look at for balancing.
 *
 * @param orig the utilization matrix from the original cluster
 * @param optimized the utilization matrix from the optimized cluster
 * @return The P value that the various derived resources come from the same probability distribution.  The probability
 * that the null hypothesis is correct.
 */
public static double[] testDifference(double[][] orig, double[][] optimized) {
  int nResources = RawAndDerivedResource.values().length;
  if (orig.length != nResources) {
    throw new IllegalArgumentException("orig must have number of rows equal to RawAndDerivedResource.");
  }
  if (optimized.length != nResources) {
    throw new IllegalArgumentException("optimized must have number of rows equal to RawAndDerivedResource.");
  }
  if (orig[0].length != optimized[0].length) {
    throw new IllegalArgumentException("The number of brokers must be the same.");
  }

  double[] pValues = new double[orig.length];

  //TODO:  For small N we want to do statistical bootstrapping (not the same as bootstrapping data).
  for (int resourceIndex = 0; resourceIndex < nResources; resourceIndex++) {
    RandomGenerator rng = new MersenneTwister(0x5d11121018463324L);
    KolmogorovSmirnovTest kolmogorovSmirnovTest = new KolmogorovSmirnovTest(rng);
    pValues[resourceIndex] =
        kolmogorovSmirnovTest.kolmogorovSmirnovTest(orig[resourceIndex], optimized[resourceIndex]);
  }

  return pValues;
}
 
开发者ID:linkedin,项目名称:cruise-control,代码行数:33,代码来源:AnalyzerUtils.java

示例2: getImportances

import org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest; //导入方法依赖的package包/类
@Override
public double[] getImportances() {
	KolmogorovSmirnovTest ks = new KolmogorovSmirnovTest();
	
	double[] res = new double[nfeat];
	for(int i = 0; i < nfeat; i++){
	    if(returnPval){
	        res[i] = ks.kolmogorovSmirnovTest(perfs, permPerfs[i]); 
	    }
	    else{
	        res[i] = ks.kolmogorovSmirnovStatistic(perfs, permPerfs[i]);
	    }
	}
	
	return res;
}
 
开发者ID:jeromepaul,项目名称:jForest,代码行数:17,代码来源:KSTestOnTreePredPerfs.java

示例3: equalityPValue

import org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest; //导入方法依赖的package包/类
public double equalityPValue() {
    KolmogorovSmirnovTest uniformityTest = new KolmogorovSmirnovTest();
    double uniformityPValue = uniformityTest.kolmogorovSmirnovTest(new UniformRealDistribution(), pValues.stream().mapToDouble(Double::doubleValue).toArray());
    return uniformityPValue;
}
 
开发者ID:crocs-muni,项目名称:classifyRSAkey,代码行数:6,代码来源:DistributionsComparator.java

示例4: predictLabelsForColumn

import org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest; //导入方法依赖的package包/类
public boolean predictLabelsForColumn(Map<String, ArrayList<Double>> trainingLabelToExamplesMap,
		ArrayList<Double> testExamples, int numPred, ArrayList<String> predictions, ArrayList<Double> confidenceScores) {

	List<Prediction> sortedPredictions = new ArrayList<Prediction>();	// descending order of p-Value
	
	KolmogorovSmirnovTest test = new KolmogorovSmirnovTest();
	
 	double pValue;
   
 	double[] sample1 = new double[testExamples.size()];
 	for(int i = 0; i < testExamples.size(); i++){
     sample1[i] = testExamples.get(i);
 	}
   
   for (Entry<String, ArrayList<Double>> entry : trainingLabelToExamplesMap.entrySet()) {
   	
   	String label = entry.getKey();
   	ArrayList<Double> trainExamples = entry.getValue();
   	
   	double[] sample2 = new double[trainExamples.size()];
   	for(int i = 0; i < trainExamples.size(); i++){
       sample2[i] = trainExamples.get(i);
   	} 	
 		
   	pValue = test.kolmogorovSmirnovTest(sample1, sample2);
   	
   	Prediction pred = new Prediction(label, pValue);

   	sortedPredictions.add(pred);
  
   }
  
	// sorting based on p-Value
	Collections.sort(sortedPredictions, new PredictionComparator());
   
	for(int j=0; j<numPred && j<sortedPredictions.size(); j++)
	{
		predictions.add(sortedPredictions.get(j).predictionLabel);
		confidenceScores.add(sortedPredictions.get(j).confidenceScore);
	}
	
	return true;
}
 
开发者ID:usc-isi-i2,项目名称:eswc-2015-semantic-typing,代码行数:44,代码来源:ApacheKSTest.java


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