本文整理汇总了Java中cern.jet.stat.Descriptive类的典型用法代码示例。如果您正苦于以下问题:Java Descriptive类的具体用法?Java Descriptive怎么用?Java Descriptive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Descriptive类属于cern.jet.stat包,在下文中一共展示了Descriptive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAllOfFromTo
import cern.jet.stat.Descriptive; //导入依赖的package包/类
/**
* Adds the part of the specified list between indexes <tt>from</tt> (inclusive) and <tt>to</tt> (inclusive) to the receiver.
*
* @param list the list of which elements shall be added.
* @param from the index of the first element to be added (inclusive).
* @param to the index of the last element to be added (inclusive).
* @throws IndexOutOfBoundsException if <tt>list.size()>0 && (from<0 || from>to || to>=list.size())</tt>.
*/
public synchronized void addAllOfFromTo(DoubleArrayList list, int from, int to) {
//if (this.arguments == null) setUpCache();
synchronized (arguments) {
// prepare arguments
arguments[0] = this.min;
arguments[1] = this.max;
arguments[2] = this.sum;
arguments[3] = this.sum_xx;
Descriptive.incrementalUpdate(list, from, to, arguments);
// store the new parameters back
this.min = arguments[0];
this.max = arguments[1];
this.sum = arguments[2];
this.sum_xx = arguments[3];
this.size += to-from+1;
}
}
示例2: addAllOfFromTo
import cern.jet.stat.Descriptive; //导入依赖的package包/类
/**
* Adds the part of the specified list between indexes <tt>from</tt> (inclusive) and <tt>to</tt> (inclusive) to the receiver.
*
* @param list the list of which elements shall be added.
* @param from the index of the first element to be added (inclusive).
* @param to the index of the last element to be added (inclusive).
* @throws IndexOutOfBoundsException if <tt>list.size()>0 && (from<0 || from>to || to>=list.size())</tt>.
*/
public synchronized void addAllOfFromTo(DoubleArrayList list, int from, int to) {
super.addAllOfFromTo(list, from, to);
if (this.sumOfPowers != null) {
//int max_k = this.min_k + this.sumOfPowers.length-1;
Descriptive.incrementalUpdateSumsOfPowers(list, from, to, 3, getMaxOrderForSumOfPowers(), this.sumOfPowers);
}
if (this.hasSumOfInversions) {
this.sumOfInversions += Descriptive.sumOfInversions(list, from, to);
}
if (this.hasSumOfLogarithms) {
this.sumOfLogarithms += Descriptive.sumOfLogarithms(list, from, to);
}
}
示例3: updateIncrementalStats
import cern.jet.stat.Descriptive; //导入依赖的package包/类
/**
* assertion: isBasicParametersValid == false
*
*/
protected void updateIncrementalStats() {
// prepare arguments
double[] arguments = new double[4];
arguments[0] = this.min;
arguments[1] = this.max;
arguments[2] = this.sum;
arguments[3] = this.sum_xx;
Descriptive.incrementalUpdate(this.elements,this.size, this.elements.size()-1,arguments);
// store the new parameters back
this.min = arguments[0];
this.max = arguments[1];
this.sum = arguments[2];
this.sum_xx = arguments[3];
this.isIncrementalStatValid = true;
this.size = this.elements.size(); // next time we don't need to redo the stuff we have just done...
}
示例4: report
import cern.jet.stat.Descriptive; //导入依赖的package包/类
@Override
public Object report(Argument args[], Context context)
throws ExtensionException, LogoException {
LogoStatsTbl tbl = StatsExtension.getTblFromArgument(args[0]);
int varNumber = ExtnUtils.getVarNumberFromArg(tbl, args[1]);
double pcnt;
try {
pcnt = args[2].getDoubleValue();
} catch (LogoException e) {
throw new ExtensionException(e.getMessage());
}
pcnt /= 100.0;
if (pcnt < 0.0 || pcnt > 100.0) {
throw new ExtensionException("The percent must be between"
+ " 0.0 and 100.0, inclusive.");
}
double[] X = tbl.getColumn(varNumber, true);
Sorting.mergeSort(X, 0, X.length);
return Descriptive.quantile(new DoubleArrayList(X), pcnt);
}
示例5: learnStateFromRegions
import cern.jet.stat.Descriptive; //导入依赖的package包/类
public void learnStateFromRegions(int state,
Collection<Region> regions) throws NotFoundException {
DoubleArrayList values = new DoubleArrayList();
for (Region r : regions) {
data.window(r.getChrom(), r.getStart(), r.getEnd());
for (int i = 0; i < data.getCount(); i++) {
for (int j = 0; j < data.getReplicates(i); j++) {
double d = Math.log(data.getRatio(i,j));
if (!(Double.isInfinite(d) || Double.isNaN(d))) {
values.add(d);
}
}
}
}
double mean = Descriptive.mean(values);
double std = Descriptive.standardDeviation(Descriptive.variance(values.size(),
Descriptive.sum(values),
Descriptive.sumOfSquares(values)));
/* TODO : verify that OpdfGaussian wants the variance rather than the stddev */
pdfs.set(state, new OpdfGaussian(mean, std * std));
}
示例6: moment
import cern.jet.stat.Descriptive; //导入依赖的package包/类
/**
* Returns the moment of <tt>k</tt>-th order with value <tt>c</tt>,
* which is <tt>Sum( (x[i]-c)<sup>k</sup> ) / size()</tt>.
*
* @param k the order; must be greater than or equal to zero.
* @param c any number.
* @throws IllegalArgumentException if <tt>k < 0</tt>.
* @return <tt>Double.NaN</tt> if <tt>!hasSumOfPower(k)</tt>.
*/
public synchronized double moment(int k, double c) {
if (k<0) throw new IllegalArgumentException("k must be >= 0");
//checkOrder(k);
if (!hasSumOfPowers(k)) return Double.NaN;
int maxOrder = Math.min(k,getMaxOrderForSumOfPowers());
DoubleArrayList sumOfPows = new DoubleArrayList(maxOrder+1);
sumOfPows.add(size());
sumOfPows.add(sum());
sumOfPows.add(sumOfSquares());
for (int i=3; i<=maxOrder; i++) sumOfPows.add(sumOfPowers(i));
return Descriptive.moment(k, c, size(), sumOfPows.elements());
}
示例7: standardize
import cern.jet.stat.Descriptive; //导入依赖的package包/类
/**
* Modifies the receiver to be standardized.
* Changes each element <tt>x[i]</tt> as follows: <tt>x[i] = (x[i]-mean)/standardDeviation</tt>.
*/
public synchronized void standardize(double mean, double standardDeviation) {
Descriptive.standardize(this.elements, mean, standardDeviation);
clearAllMeasures();
invalidateAll();
this.size = 0;
}
示例8: sumOfPowers
import cern.jet.stat.Descriptive; //导入依赖的package包/类
/**
* Returns the <tt>k-th</tt> order sum of powers, which is <tt>Sum( x[i]<sup>k</sup> )</tt>.
* @param k the order of the powers.
* @return the sum of powers.
*/
public synchronized double sumOfPowers(int k) {
// no chaching for this measure
if (k >= -1 && k <= 2) return super.sumOfPowers(k);
return Descriptive.sumOfPowers(this.elements,k);
}
示例9: bandwidthNRD
import cern.jet.stat.Descriptive; //导入依赖的package包/类
public double bandwidthNRD(double[] in) {
DoubleArrayList inList = new DoubleArrayList(in.length);
for (double d : in)
inList.add(d);
inList.sort();
final double h = (Descriptive.quantile(inList, 0.75) - Descriptive.quantile(inList, 0.25)) / 1.34;
return 4 * 1.06 *
Math.min(Math.sqrt(DiscreteStatistics.variance(in)), h) *
Math.pow(in.length, -0.2);
}
示例10: bandwidthNRD
import cern.jet.stat.Descriptive; //导入依赖的package包/类
public double bandwidthNRD(double[] in) {
DoubleArrayList inList = new DoubleArrayList(in.length);
for (double d : in)
inList.add(d);
inList.sort();
final double h = (Descriptive.quantile(inList, 0.75) - Descriptive
.quantile(inList, 0.25)) / 1.34;
return 4 * 1.06
* Math.min(Math.sqrt(DiscreteStatistics.variance(in)), h)
* Math.pow(in.length, -0.2);
}
示例11: opAutoCorrelation
import cern.jet.stat.Descriptive; //导入依赖的package包/类
/**
* Returns the auto-correlation of a data sequence.
*
* @param scope
* @param data
* @param lag
* @param mean
* @param variance
* @return
*/
@operator(value = "auto_correlation", can_be_const = true, type = IType.FLOAT, expected_content_type = {
IType.INT, IType.FLOAT }, concept = { IConcept.STATISTIC })
@doc(value = "Returns the auto-correlation of a data sequence", comment = "", examples = {})
public static Double opAutoCorrelation(final IScope scope, final IContainer data, final Integer lag) {
// TODO input parameters validation
final double mean = (Double) Containers.mean(scope, data);
final double variance = Stats.opVariance(scope, data);
return Descriptive.autoCorrelation(from(scope, data), lag, mean, variance);
}
示例12: opCovariance
import cern.jet.stat.Descriptive; //导入依赖的package包/类
/**
*
*
* @param scope
* @param data1
* @param data2
* @return
*/
@operator(value = "covariance", can_be_const = true, type = IType.FLOAT, expected_content_type = { IType.INT,
IType.FLOAT }, concept = { IConcept.STATISTIC })
@doc(value = "Returns the covariance of two data sequences", comment = "", examples = {})
public static Double opCovariance(final IScope scope, final IContainer data1, final IContainer data2) {
// TODO input parameters validation
return Descriptive.covariance(from(scope, data1), from(scope, data2));
}
示例13: opDurbinWatson
import cern.jet.stat.Descriptive; //导入依赖的package包/类
/**
*
*
* @param scope
* @param data
* @return
*/
@operator(value = "durbin_watson", can_be_const = true, type = IType.FLOAT, expected_content_type = { IType.INT,
IType.FLOAT }, concept = { IConcept.STATISTIC })
@doc(value = "Durbin-Watson computation", comment = "", examples = {})
public static Double opDurbinWatson(final IScope scope, final IContainer data) {
// TODO input parameters validation
return Descriptive.durbinWatson(from(scope, data));
}
示例14: kurtosis
import cern.jet.stat.Descriptive; //导入依赖的package包/类
/**
*
*
* @param scope
* @param data
* @return
*/
@operator(value = "kurtosis", can_be_const = true, type = IType.FLOAT, expected_content_type = { IType.INT,
IType.FLOAT }, concept = { IConcept.STATISTIC })
@doc(value = "Returns the kurtosis (aka excess) of a data sequence", comment = "", examples = {})
public static Double opKurtosis(final IScope scope, final IContainer data) {
// TODO input parameters validation
final double mean = (Double) Containers.mean(scope, data);
final double standardDeviation = Stats.opStDev(scope, data);
return Descriptive.kurtosis(from(scope, data), mean, standardDeviation);
}
示例15: opQuantile
import cern.jet.stat.Descriptive; //导入依赖的package包/类
/**
*
*
* @param scope
* @param data
* @param phi
* @return
*/
@operator(value = "quantile", can_be_const = true, type = IType.FLOAT, expected_content_type = { IType.INT,
IType.FLOAT }, concept = { IConcept.STATISTIC })
@doc(value = "Returns the phi-quantile; that is, an element elem for which holds that phi percent of data elements are less than elem. The quantile need not necessarily be contained in the data sequence, it can be a linear interpolation.", comment = "", examples = {})
public static Double opQuantile(final IScope scope, final IContainer data, final Double phi) {
// TODO input parameters validation
return Descriptive.quantile(from(scope, data), phi);
}