• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java KolmogorovSmirnovTest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



KolmogorovSmirnovTest类属于org.apache.commons.math3.stat.inference包,在下文中一共展示了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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NotFilter类代码示例发布时间:2022-05-22
下一篇:
Java InternalCompassOrientationProvider类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap