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


Java StorelessUnivariateStatistic类代码示例

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


StorelessUnivariateStatistic类属于org.apache.commons.math3.stat.descriptive包,在下文中一共展示了StorelessUnivariateStatistic类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCopyConsistencyWithInitialMostElements

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
/**
 * Verifies that copied statistics remain equal to originals when
 * incremented the same way by making the copy after a majority of elements
 * are incremented
 */
@Test
public void testCopyConsistencyWithInitialMostElements() {

    StorelessUnivariateStatistic master =
            (StorelessUnivariateStatistic) getUnivariateStatistic();

    StorelessUnivariateStatistic replica = null;

    // select a portion of testArray till 75 % of the length to load first
    long index = FastMath.round(0.75 * testArray.length);

    // Put first half in master and copy master to replica
    master.incrementAll(testArray, 0, (int) index);
    replica = master.copy();

    // Check same
    Assert.assertTrue(replica.equals(master));
    Assert.assertTrue(master.equals(replica));

    // Now add second part to both and check again
    master.incrementAll(testArray, (int) index,
            (int) (testArray.length - index));
    replica.incrementAll(testArray, (int) index,
            (int) (testArray.length - index));
    Assert.assertTrue(replica.equals(master));
    Assert.assertTrue(master.equals(replica));
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:33,代码来源:PSquarePercentileTest.java

示例2: testCopyConsistencyWithInitialFirstFewElements

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
/**
 * Verifies that copied statistics remain equal to originals when
 * incremented the same way by way of copying original after just a few
 * elements are incremented
 */
@Test
public void testCopyConsistencyWithInitialFirstFewElements() {

    StorelessUnivariateStatistic master =
            (StorelessUnivariateStatistic) getUnivariateStatistic();

    StorelessUnivariateStatistic replica = null;

    // select a portion of testArray which is 10% of the length to load
    // first
    long index = FastMath.round(0.1 * testArray.length);

    // Put first half in master and copy master to replica
    master.incrementAll(testArray, 0, (int) index);
    replica = master.copy();

    // Check same
    Assert.assertTrue(replica.equals(master));
    Assert.assertTrue(master.equals(replica));
    // Now add second part to both and check again
    master.incrementAll(testArray, (int) index,
            (int) (testArray.length - index));
    replica.incrementAll(testArray, (int) index,
            (int) (testArray.length - index));
    Assert.assertTrue(master.equals(master));
    Assert.assertTrue(replica.equals(replica));
    Assert.assertTrue(replica.equals(master));
    Assert.assertTrue(master.equals(replica));
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:35,代码来源:PSquarePercentileTest.java

示例3: evaluate

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
@Override
public FieldValue evaluate(List<FieldValue> arguments){
	StorelessUnivariateStatistic statistic = createStatistic();

	DataType dataType = null;

	// "Missing values in the input to an aggregate function are simply ignored"
	Iterable<FieldValue> values = Iterables.filter(arguments, Predicates.notNull());
	for(FieldValue value : values){
		statistic.increment((value.asNumber()).doubleValue());

		if(dataType != null){
			dataType = TypeUtil.getResultDataType(dataType, value.getDataType());
		} else

		{
			dataType = value.getDataType();
		}
	}

	// "If all inputs are missing, then the result evaluates to a missing value"
	if(statistic.getN() == 0){
		return null;
	}

	Double result = statistic.getResult();

	return FieldValueUtil.create(getResultType(dataType), OpType.CONTINUOUS, result);
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:30,代码来源:AggregateFunction.java

示例4: rootMeanSquaredError

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
/**
 * @param classifier a {@link com.cloudera.oryx.rdf.common.tree.TreeBasedClassifier} (e.g. {@link com.cloudera.oryx.rdf.common.tree.DecisionForest})
 *  trained on data with a numeric target
 * @param testSet test set to evaluate on
 * @return root mean squared error over the test set square root of mean squared difference between actual
 *  and predicted numeric target value
 */
public static double rootMeanSquaredError(TreeBasedClassifier classifier, Iterable<Example> testSet) {
  StorelessUnivariateStatistic mse = new Mean();
  for (Example test : testSet) {
    NumericFeature actual = (NumericFeature) test.getTarget();
    NumericPrediction prediction = (NumericPrediction) classifier.classify(test);
    double diff = actual.getValue() - prediction.getPrediction();
    mse.increment(diff * diff);
  }
  return FastMath.sqrt(mse.getResult());
}
 
开发者ID:apsaltis,项目名称:oryx,代码行数:18,代码来源:Evaluation.java

示例5: meanAbs

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
/**
 * @param testSet test set to evaluate on
 * @return average absolute value of numeric target value in the test set
 */
private static double meanAbs(Iterable<Example> testSet) {
  StorelessUnivariateStatistic mean = new Mean();
  for (Example test : testSet) {
    NumericFeature actual = (NumericFeature) test.getTarget();
    mean.increment(FastMath.abs(actual.getValue()));
  }
  return mean.getResult();
}
 
开发者ID:apsaltis,项目名称:oryx,代码行数:13,代码来源:Evaluation.java

示例6: buildNumericPrediction

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
static NumericPrediction buildNumericPrediction(Iterable<Example> examples) {
  StorelessUnivariateStatistic mean = new Mean();
  for (Example example : examples) {
    mean.increment(((NumericFeature) example.getTarget()).getValue());
  }
  Preconditions.checkState(mean.getN() > 0);
  return new NumericPrediction((float) mean.getResult(), (int) mean.getN());
}
 
开发者ID:apsaltis,项目名称:oryx,代码行数:9,代码来源:NumericPrediction.java

示例7: copy

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
@Override
public StorelessUnivariateStatistic copy() {
	return new NullStorelessUnivariateStatistic();
}
 
开发者ID:eclipse,项目名称:january,代码行数:5,代码来源:NullStorelessUnivariateStatistic.java

示例8: JsonStorelessStatistic

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
public JsonStorelessStatistic(Statistic stat, StorelessUnivariateStatistic statImpl) {
    this.stat = stat;
    this.statImpl = statImpl;
}
 
开发者ID:quarks-edge,项目名称:quarks,代码行数:5,代码来源:JsonStorelessStatistic.java

示例9: checkClearValue

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
@Override
protected void checkClearValue(StorelessUnivariateStatistic statistic){
    Assert.assertEquals(0, statistic.getResult(), 0);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:5,代码来源:SumSqTest.java

示例10: checkClearValue

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
@Override
protected void checkClearValue(StorelessUnivariateStatistic statistic){
    Assert.assertEquals(1, statistic.getResult(), 0);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:5,代码来源:ProductTest.java

示例11: AbstractStorelessStatistic

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
protected AbstractStorelessStatistic(final StorelessUnivariateStatistic stat) {
    this.stat = stat;
}
 
开发者ID:cardillo,项目名称:joinery,代码行数:4,代码来源:Aggregation.java

示例12: AbstractCumulativeFunction

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
protected AbstractCumulativeFunction(final StorelessUnivariateStatistic stat, final Number initialValue) {
    this.stat = stat;
    this.initialValue = initialValue;
    reset();
}
 
开发者ID:cardillo,项目名称:joinery,代码行数:6,代码来源:Transforms.java

示例13: createStatistic

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
abstract
public StorelessUnivariateStatistic createStatistic();
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:3,代码来源:AggregateFunction.java

示例14: setSumLogImpl

import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic; //导入依赖的package包/类
/**
 * <p>Sets the implementation for the sum of logs.</p>
 * <p>This method must be activated before any data has been added - i.e.,
 * before {@link #increment(double) increment} has been used to add data;
 * otherwise an IllegalStateException will be thrown.</p>
 *
 * @param sumLogImpl the StorelessUnivariateStatistic instance to use
 * for computing the log sum
 * @throws MathIllegalStateException if data has already been added
 *  (i.e if n > 0)
 */
public void setSumLogImpl(StorelessUnivariateStatistic sumLogImpl)
throws MathIllegalStateException {
    checkEmpty();
    this.sumOfLogs = sumLogImpl;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:17,代码来源:GeometricMean.java


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