本文整理汇总了Java中org.apache.commons.math.stat.descriptive.rank.Median类的典型用法代码示例。如果您正苦于以下问题:Java Median类的具体用法?Java Median怎么用?Java Median使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Median类属于org.apache.commons.math.stat.descriptive.rank包,在下文中一共展示了Median类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSummaryStatistics
import org.apache.commons.math.stat.descriptive.rank.Median; //导入依赖的package包/类
public static Double[] getSummaryStatistics(Double[] variable){
double[] primitiveVariable = new double[variable.length];
for(int i=0; i<variable.length; i++){
primitiveVariable[i] = variable[i];
}
Double[] out = new Double[4];
out[0] = (new Mean()).evaluate(primitiveVariable);
out[1] = (new Median()).evaluate(primitiveVariable);
out[2] = (new Variance()).evaluate(primitiveVariable);
out[3] = Math.sqrt(out[2]);
return out;
}
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:15,代码来源:CaseToCaseTreeLikelihood.java
示例2: export
import org.apache.commons.math.stat.descriptive.rank.Median; //导入依赖的package包/类
@Override
public void export(RandomAccessMDLReader reader, EncodingFingerprint fingerprinter, String label, File outputFile, boolean useAromaticFlag) {
DecimalFormat df = new DecimalFormat();
double[] features = new double[reader.getSize()];
Long start = System.currentTimeMillis();
for (int indexMol = 0; indexMol < reader.getSize(); indexMol++) {
if ((indexMol != 0) && (indexMol % 1000 == 0))
System.out.println("encodings/s = "
+ df.format(((double) indexMol) / ((double) ((System.currentTimeMillis() - start) / 1000)))
+ "\t(mappings so far = " + indexMol + ", @"
+ df.format(((double) indexMol / (double) reader.getSize()) * 100) + "%)");
IAtomContainer mol = reader.getMol(indexMol);
FeatureMap featureMap = new FeatureMap(fingerprinter.getFingerprint(mol));
features[indexMol] = featureMap.getKeySet().size();
}
Long end = System.currentTimeMillis();
Mean mean = new Mean();
StandardDeviation stdv = new StandardDeviation();
Max max = new Max();
Median median = new Median();
System.out.println("Time elapsed: " + (end - start) + " ms");
System.out.println("mol/s = " + df.format(reader.getSize() / ((double) (end - start) / 1000)));
System.out.println("no. features = " + df.format(mean.evaluate(features)) + "\t" + df.format(stdv.evaluate(features)));
System.out.println("Max = " + df.format(max.evaluate(features)));
System.out.println("Median = " + df.format(median.evaluate(features)));
}
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:31,代码来源:ExporterBenchmark.java
示例3: initialize
import org.apache.commons.math.stat.descriptive.rank.Median; //导入依赖的package包/类
private void initialize(Filter<Pair<WellKey,ResultValue>> scoringFilter,
AggregateFunction<Double> scoringFunc)
{
Collection<Double> aggregationValues = new ArrayList<Double>();
for (WellKey wellKey : _resultValues.keySet()) {
if (wellKey.getPlateNumber() == _plateNumber) {
ResultValue rv = getResultValue(wellKey.getRow(), wellKey.getColumn());
if (rv != null && !scoringFilter.exclude(new Pair<WellKey,ResultValue>(wellKey, rv))) {
aggregationValues.add(getRawValue(wellKey.getRow(), wellKey.getColumn()));
}
}
}
scoringFunc.initializeAggregates(aggregationValues);
_statistics = new DescriptiveStatisticsImpl();
ResizableDoubleArray medianValues = new ResizableDoubleArray();
for (Double rawValue : aggregationValues) {
double scoredValue = scoringFunc.compute(rawValue);
_statistics.addValue(scoredValue);
medianValues.addElement(scoredValue);
}
_median = new Median().evaluate(medianValues.getElements());
_scalableColorFunction.setLowerLimit(_statistics.getMin());
_scalableColorFunction.setUpperLimit(_statistics.getMax());
}
开发者ID:hmsiccbl,项目名称:screensaver,代码行数:30,代码来源:HeatMap.java
示例4: getMedianTestScore
import org.apache.commons.math.stat.descriptive.rank.Median; //导入依赖的package包/类
/**
* <p>
* Calculate the median score achieved on a Test.
* </p>
*/
public static double getMedianTestScore(int testID)
throws SQLException
{
Logger log = Logger.getLogger();
boolean loggingEnabled = log.isLoggingEnabled();
Median median = new Median();
ArrayList arraylist = new ArrayList();
Connection conn = getDefaultConnection();
try {
log.enableLogging( false );
PreparedStatement ps = Utils.prepare
(
conn,
"select tk.score\n" +
"from TestTaking tk, LastTaking lt\n" +
"where tk.takingID = lt.takingID\n" +
"and tk.testID = ?\n"
);
ps.setInt( 1, testID );
ResultSet rs = ps.executeQuery();
while( rs.next() )
{
arraylist.add(new Double(rs.getDouble(1)));
}
Utils.close(rs);
Utils.close(ps);
}
finally
{
log.enableLogging( loggingEnabled );
}
int count = arraylist.size();
double values[] = new double[ count ];
for ( int i = 0; i < count; i++)
{ values[ i ] = ((Double)arraylist.get(i)).doubleValue(); }
return median.evaluate( values );
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:52,代码来源:Functions.java
注:本文中的org.apache.commons.math.stat.descriptive.rank.Median类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论