本文整理汇总了Java中org.apache.commons.math3.stat.descriptive.rank.Max类的典型用法代码示例。如果您正苦于以下问题:Java Max类的具体用法?Java Max怎么用?Java Max使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Max类属于org.apache.commons.math3.stat.descriptive.rank包,在下文中一共展示了Max类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MultivariateSummaryStatistics
import org.apache.commons.math3.stat.descriptive.rank.Max; //导入依赖的package包/类
/**
* Construct a MultivariateSummaryStatistics instance
* @param k dimension of the data
* @param isCovarianceBiasCorrected if true, the unbiased sample
* covariance is computed, otherwise the biased population covariance
* is computed
*/
public MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {
this.k = k;
sumImpl = new StorelessUnivariateStatistic[k];
sumSqImpl = new StorelessUnivariateStatistic[k];
minImpl = new StorelessUnivariateStatistic[k];
maxImpl = new StorelessUnivariateStatistic[k];
sumLogImpl = new StorelessUnivariateStatistic[k];
geoMeanImpl = new StorelessUnivariateStatistic[k];
meanImpl = new StorelessUnivariateStatistic[k];
for (int i = 0; i < k; ++i) {
sumImpl[i] = new Sum();
sumSqImpl[i] = new SumOfSquares();
minImpl[i] = new Min();
maxImpl[i] = new Max();
sumLogImpl[i] = new SumOfLogs();
geoMeanImpl[i] = new GeometricMean();
meanImpl[i] = new Mean();
}
covarianceImpl =
new VectorialCovariance(k, isCovarianceBiasCorrected);
}
示例2: calculateParamMax
import org.apache.commons.math3.stat.descriptive.rank.Max; //导入依赖的package包/类
/**
* @param numberOfUtterances number of utterances
* @param fileNumber file number
* @param audioParams audio parameters
* @param maxParam old maximum value of audio parameter
* @return maxParam new maximum value of audio parameter
*/
private static double[][] calculateParamMax(int numberOfUtterances,
int fileNumber, String[][] audioParams, double[][] maxParam) {
for (int cols=0; cols<HEADER_COLUMNS; cols++) {
maxParam[fileNumber][cols] = 0;
}
for (int cols=HEADER_COLUMNS; cols<PARAMS_NUM; cols++) {
double[] colValues = new double[numberOfUtterances];
for (int rows =0; rows< numberOfUtterances; rows++) {
if (!audioParams[rows][cols].equals("")) {
colValues[rows] = Double.parseDouble(audioParams[rows][cols].replace("%",""));
}
else
colValues[rows] = 0;
}
maxParam[fileNumber][cols] = new Max().evaluate(colValues);
}
return maxParam;
}
示例3: testSummaryConsistency
import org.apache.commons.math3.stat.descriptive.rank.Max; //导入依赖的package包/类
@Test
public void testSummaryConsistency() {
final DescriptiveStatistics dstats = new DescriptiveStatistics();
final SummaryStatistics sstats = new SummaryStatistics();
final int windowSize = 5;
dstats.setWindowSize(windowSize);
final double tol = 1E-12;
for (int i = 0; i < 20; i++) {
dstats.addValue(i);
sstats.clear();
double[] values = dstats.getValues();
for (int j = 0; j < values.length; j++) {
sstats.addValue(values[j]);
}
TestUtils.assertEquals(dstats.getMean(), sstats.getMean(), tol);
TestUtils.assertEquals(new Mean().evaluate(values), dstats.getMean(), tol);
TestUtils.assertEquals(dstats.getMax(), sstats.getMax(), tol);
TestUtils.assertEquals(new Max().evaluate(values), dstats.getMax(), tol);
TestUtils.assertEquals(dstats.getGeometricMean(), sstats.getGeometricMean(), tol);
TestUtils.assertEquals(new GeometricMean().evaluate(values), dstats.getGeometricMean(), tol);
TestUtils.assertEquals(dstats.getMin(), sstats.getMin(), tol);
TestUtils.assertEquals(new Min().evaluate(values), dstats.getMin(), tol);
TestUtils.assertEquals(dstats.getStandardDeviation(), sstats.getStandardDeviation(), tol);
TestUtils.assertEquals(dstats.getVariance(), sstats.getVariance(), tol);
TestUtils.assertEquals(new Variance().evaluate(values), dstats.getVariance(), tol);
TestUtils.assertEquals(dstats.getSum(), sstats.getSum(), tol);
TestUtils.assertEquals(new Sum().evaluate(values), dstats.getSum(), tol);
TestUtils.assertEquals(dstats.getSumsq(), sstats.getSumsq(), tol);
TestUtils.assertEquals(new SumOfSquares().evaluate(values), dstats.getSumsq(), tol);
TestUtils.assertEquals(dstats.getPopulationVariance(), sstats.getPopulationVariance(), tol);
TestUtils.assertEquals(new Variance(false).evaluate(values), dstats.getPopulationVariance(), tol);
}
}
示例4: fisherG
import org.apache.commons.math3.stat.descriptive.rank.Max; //导入依赖的package包/类
/**
* Use the Fisher g-value to find periodicity in signal.
* See <a href="http://www.mathworks.com/help/signal/ug/significance-testing-for-periodic-component.html">here</a> for background.
*
* @return value of the fisher-g test statistic
*
*/
private double fisherG() {
double maxVal = new Max().evaluate(periodogram);
fisherGValue = maxVal / new Sum().evaluate(periodogram);
return fisherGValue;
}
示例5: run
import org.apache.commons.math3.stat.descriptive.rank.Max; //导入依赖的package包/类
public void run() {
if(!plugin.getPlayerDataMap().isEmpty()){
for (Map.Entry<UUID, PlayerData> entry : plugin.getPlayerDataMap().entrySet()) {
UUID playerId = entry.getKey();
for(ClickData data : entry.getValue().getClickSignals()) {
String name = Bukkit.getPlayer(playerId).getDisplayName();
if(!data.isEmpty()) {
double[] dataArray = data.toDoubleArray();
double sum = new Sum().evaluate(dataArray);
if(sum != 0) {
double cps = new ClicksPerSecond(dataArray, plugin.getSamplePeriod()).getClicksPerSecond();
double mean = new Mean().evaluate(dataArray);
double max = new Max().evaluate(dataArray);
double std = new StandardDeviation().evaluate(dataArray);
Logger logger = plugin.getLogger();
String msg = "Descriptive Analysis of " + data.getClickType().toString();
msg += " clicking for " + name + ":";
logger.info(msg);
logger.info(" Size: " + Integer.toString(data.size()));
logger.info(" Max: " + Double.toString(max));
logger.info(" Mean: " + Double.toString(mean));
logger.info(" Sum: " + Double.toString(sum));
logger.info(" Std: " + Double.toString(std));
logger.info(" CPS: " + cps);
}
}
}
}
}
}
示例6: getOutputBeginIdx
import org.apache.commons.math3.stat.descriptive.rank.Max; //导入依赖的package包/类
@Override
public Integer getOutputBeginIdx() {
Max max = new Max();
double[] ds = new double[]{(double)chaikin.getOutBegIdx().value, (double)priceSma20.getOutBegIdx().value, (double)priceSma65.getOutBegIdx().value, (double)chaikinSma20.getOutBegIdx().value, (double)chaikinSma65.getOutBegIdx().value};
double maximum = max.evaluate(ds);
return (int) maximum + getDaysSpan();
}
示例7: copy
import org.apache.commons.math3.stat.descriptive.rank.Max; //导入依赖的package包/类
/**
* Copies source to dest.
* <p>Neither source nor dest can be null.</p>
*
* @param source SummaryStatistics to copy
* @param dest SummaryStatistics to copy to
* @throws NullArgumentException if either source or dest is null
*/
public static void copy(SummaryStatistics source, SummaryStatistics dest)
throws NullArgumentException {
MathUtils.checkNotNull(source);
MathUtils.checkNotNull(dest);
dest.maxImpl = source.maxImpl.copy();
dest.minImpl = source.minImpl.copy();
dest.sumImpl = source.sumImpl.copy();
dest.sumLogImpl = source.sumLogImpl.copy();
dest.sumsqImpl = source.sumsqImpl.copy();
dest.secondMoment = source.secondMoment.copy();
dest.n = source.n;
// Keep commons-math supplied statistics with embedded moments in synch
if (source.getVarianceImpl() instanceof Variance) {
dest.varianceImpl = new Variance(dest.secondMoment);
} else {
dest.varianceImpl = source.varianceImpl.copy();
}
if (source.meanImpl instanceof Mean) {
dest.meanImpl = new Mean(dest.secondMoment);
} else {
dest.meanImpl = source.meanImpl.copy();
}
if (source.getGeoMeanImpl() instanceof GeometricMean) {
dest.geoMeanImpl = new GeometricMean((SumOfLogs) dest.sumLogImpl);
} else {
dest.geoMeanImpl = source.geoMeanImpl.copy();
}
// Make sure that if stat == statImpl in source, same
// holds in dest; otherwise copy stat
if (source.geoMean == source.geoMeanImpl) {
dest.geoMean = (GeometricMean) dest.geoMeanImpl;
} else {
GeometricMean.copy(source.geoMean, dest.geoMean);
}
if (source.max == source.maxImpl) {
dest.max = (Max) dest.maxImpl;
} else {
Max.copy(source.max, dest.max);
}
if (source.mean == source.meanImpl) {
dest.mean = (Mean) dest.meanImpl;
} else {
Mean.copy(source.mean, dest.mean);
}
if (source.min == source.minImpl) {
dest.min = (Min) dest.minImpl;
} else {
Min.copy(source.min, dest.min);
}
if (source.sum == source.sumImpl) {
dest.sum = (Sum) dest.sumImpl;
} else {
Sum.copy(source.sum, dest.sum);
}
if (source.variance == source.varianceImpl) {
dest.variance = (Variance) dest.varianceImpl;
} else {
Variance.copy(source.variance, dest.variance);
}
if (source.sumLog == source.sumLogImpl) {
dest.sumLog = (SumOfLogs) dest.sumLogImpl;
} else {
SumOfLogs.copy(source.sumLog, dest.sumLog);
}
if (source.sumsq == source.sumsqImpl) {
dest.sumsq = (SumOfSquares) dest.sumsqImpl;
} else {
SumOfSquares.copy(source.sumsq, dest.sumsq);
}
}
示例8: getDistribution
import org.apache.commons.math3.stat.descriptive.rank.Max; //导入依赖的package包/类
public DistributionApproximation getDistribution(Connection conn, DataTableName tableName, VariableName thetaName,
VariableName weightName, boolean hasWeight)throws SQLException {
points = new ArrayList<Double>();
Min min = new Min();
Max max = new Max();
Table sqlTable = new Table(tableName.getNameForDatabase());
SelectQuery query = new SelectQuery();
query.addColumn(sqlTable, thetaName.nameForDatabase());
if(hasWeight){
query.addColumn(sqlTable, weightName.nameForDatabase());
weights = new ArrayList<Double>();
}
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery(query.toString());
double value = 0.0;
double w = 1.0;
while(rs.next()){
value = rs.getDouble(thetaName.nameForDatabase());
if(!rs.wasNull()){
if(hasWeight){
w = rs.getDouble(weightName.nameForDatabase());
if(rs.wasNull()){
w=0.0;
}
points.add(value);
weights.add(w);
min.increment(value);
max.increment(value);
}else{
points.add(value);
min.increment(value);
max.increment(value);
}
}
}
rs.close();
stmt.close();
ContinuousDistributionApproximation dist = new ContinuousDistributionApproximation(points.size(), min.getResult(), max.getResult());
if(hasWeight){
for(int i=0;i<points.size();i++){
dist.setPointAt(i, points.get(i));
dist.setDensityAt(i, weights.get(i));
}
}else{
for(int i=0;i<points.size();i++){
dist.setPointAt(i, points.get(i));
}
}
return dist;
}
示例9: initializeGridPoints
import org.apache.commons.math3.stat.descriptive.rank.Max; //导入依赖的package包/类
private void initializeGridPoints()throws SQLException{
Statement stmt = null;
ResultSet rs = null;
//connect to db
try{
Table sqlTable = new Table(tableName.getNameForDatabase());
SelectQuery select = new SelectQuery();
select.addColumn(sqlTable, regressorVariable.getName().nameForDatabase());
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(select.toString());
Min min = new Min();
Max max = new Max();
Mean mean = new Mean();
StandardDeviation sd = new StandardDeviation();
double value = 0.0;
while(rs.next()){
value = rs.getDouble(regressorVariable.getName().nameForDatabase());
if(!rs.wasNull()){
min.increment(value);
max.increment(value);
mean.increment(value);
sd.increment(value);
}
updateProgress();
}
rs.close();
stmt.close();
//evaluation points
double sdv = sd.getResult();
double mn = mean.getResult();
double lower = mn-2.5*sdv;
double upper = mn+2.5*sdv;
bwAdjustment *= sdv;
bandwidth = new NonparametricIccBandwidth(sampleSize, bwAdjustment);
gridPoints = command.getFreeOption("gridpoints").getInteger();
// uniformDistributionApproximation = new UniformDistributionApproximation(
// min.getResult(), max.getResult(), gridPoints);
uniformDistributionApproximation = new UniformDistributionApproximation(
lower, upper, gridPoints);
}catch(SQLException ex){
throw ex;
}finally{
if(rs!=null) rs.close();
if(stmt!=null) stmt.close();
}
}
示例10: createStatistic
import org.apache.commons.math3.stat.descriptive.rank.Max; //导入依赖的package包/类
@Override
public Max createStatistic(){
return new Max();
}
示例11: RunningStatistics
import org.apache.commons.math3.stat.descriptive.rank.Max; //导入依赖的package包/类
public RunningStatistics() {
this.mean = new Mean();
this.min = new Min();
this.max = new Max();
}