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


Java TTest.tTest方法代码示例

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


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

示例1: checkTimeSeriesSimularityTtest

import org.apache.commons.math3.stat.inference.TTest; //导入方法依赖的package包/类
private boolean checkTimeSeriesSimularityTtest(double[] r_generated, double[] java_generated) {
    TTest t_test_obj = new TTest();
    // Performs a paired t-test evaluating the null hypothesis that the mean of the paired
    // differences between sample1
    // and sample2 is 0 in favor of the two-sided alternative that the mean paired difference is not
    // equal to 0,
    // with significance level 0.05.
    double p_value = t_test_obj.tTest(r_generated, java_generated);
    boolean reject_null_hyphothesis = (p_value < 0.05);
    return reject_null_hyphothesis;
}
 
开发者ID:ruananswer,项目名称:twitter-anomalyDetection-java,代码行数:12,代码来源:STLTest.java

示例2: evaluate

import org.apache.commons.math3.stat.inference.TTest; //导入方法依赖的package包/类
@Override
public double evaluate(double[] baseline, double[] treatment) {

  double[] boostedBaseline = multiply(baseline, boost);

  /*
  double sampleSum = 0;
  double sampleSumSquares = 0;
  int n = boostedBaseline.length;

  for (int i = 0; i < baseline.length; i++) {
    double delta = treatment[i] - boostedBaseline[i];
    sampleSum += delta;
    sampleSumSquares += delta * delta;
  }

  double sampleVariance = sampleSumSquares / (n - 1);
  double sampleMean = sampleSum / baseline.length;

  double sampleDeviation = Math.sqrt(sampleVariance);
  double meanDeviation = sampleDeviation / Math.sqrt(n);
  double t = sampleMean / meanDeviation;

  return 1.0 - Stat.studentTProb(t, n - 1);
  */

  //- Use Apache Commons Math3 directly for t-test p-value calculation
  TTest tt = new TTest();
  double pval = tt.tTest (boostedBaseline, treatment);

  return 1.0 - pval;
}
 
开发者ID:teanalab,项目名称:demidovii,代码行数:33,代码来源:PairedTTest.java

示例3: checkTimeSeriesSimularityTtest

import org.apache.commons.math3.stat.inference.TTest; //导入方法依赖的package包/类
private boolean checkTimeSeriesSimularityTtest(double[] r_generated, double[] java_generated) {
    TTest t_test_obj = new TTest();
    // Performs a paired t-test evaluating the null hypothesis that the mean of the paired differences between sample1
    // and sample2 is 0 in favor of the two-sided alternative that the mean paired difference is not equal to 0,
    // with significance level 0.05.
    double p_value = t_test_obj.tTest(r_generated, java_generated);
    boolean reject_null_hyphothesis = (p_value < 0.05);
    return reject_null_hyphothesis;
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:10,代码来源:STLTest.java

示例4: predictLabelsForColumn

import org.apache.commons.math3.stat.inference.TTest; //导入方法依赖的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
		
    TTest test = new TTest();  		
		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.tTest(sample1, sample2);
    	
    	Prediction pred = new Prediction(label, pValue);
    	
//    	double tValue = Math.abs(test.t(sample1, sample2));
//    	Prediction pred = new Prediction(label, tValue);

    	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,代码行数:46,代码来源:WelchTTest.java


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