本文整理汇总了Java中org.apache.commons.math.stat.descriptive.moment.Mean.increment方法的典型用法代码示例。如果您正苦于以下问题:Java Mean.increment方法的具体用法?Java Mean.increment怎么用?Java Mean.increment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.stat.descriptive.moment.Mean
的用法示例。
在下文中一共展示了Mean.increment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reduce
import org.apache.commons.math.stat.descriptive.moment.Mean; //导入方法依赖的package包/类
public void reduce(Text key,
Iterator<DoubleWritable> values,
OutputCollector<AvroWrapper<StockAvg>,
NullWritable> output,
Reporter reporter) throws IOException {
Mean mean = new Mean();
while (values.hasNext()) {
mean.increment(values.next().get());
}
StockAvg avg = new StockAvg();
avg.setSymbol(key.toString());
avg.setAvg(mean.getResult());
output.collect(new AvroWrapper<StockAvg>(avg),
NullWritable.get());
}
示例2: reduce
import org.apache.commons.math.stat.descriptive.moment.Mean; //导入方法依赖的package包/类
@Override
protected void reduce(Text key, Iterable<DoubleWritable> values, Context context) throws IOException, InterruptedException {
Mean mean = new Mean();
for (DoubleWritable val: values) {
mean.increment(val.get());
}
StockAvg avg = new StockAvg();
avg.setSymbol(key.toString());
avg.setAvg(mean.getResult());
context.write(key, new AvroValue<StockAvg>(avg));
}
示例3: reduce
import org.apache.commons.math.stat.descriptive.moment.Mean; //导入方法依赖的package包/类
@Override
public void reduce(Utf8 symbol, Iterable<Stock> stocks,
AvroCollector<StockAvg> collector,
Reporter reporter) throws IOException {
Mean mean = new Mean();
for (Stock stock : stocks) {
mean.increment(stock.getOpen());
}
StockAvg avg = new StockAvg();
avg.setSymbol(symbol.toString());
avg.setAvg(mean.getResult());
collector.collect(avg);
}
示例4: reduce
import org.apache.commons.math.stat.descriptive.moment.Mean; //导入方法依赖的package包/类
@Override
protected void reduce(Text key, Iterable<DoubleWritable> values, Context context) throws IOException, InterruptedException {
Mean mean = new Mean();
for (DoubleWritable val : values) {
mean.increment(val.get());
}
Group group = factory.newGroup()
.append("symbol", key.toString())
.append("avg", mean.getResult());
context.write(null, group);
}
示例5: reduce
import org.apache.commons.math.stat.descriptive.moment.Mean; //导入方法依赖的package包/类
@Override
protected void reduce(Text key, Iterable<DoubleWritable> values, Context context) throws IOException, InterruptedException {
Mean mean = new Mean();
for (DoubleWritable val : values) {
mean.increment(val.get());
}
StockAvg avg = new StockAvg();
avg.setSymbol(key.toString());
avg.setAvg(mean.getResult());
context.write(null, avg);
}
示例6: getMeanStateStringSize
import org.apache.commons.math.stat.descriptive.moment.Mean; //导入方法依赖的package包/类
@Override
public int getMeanStateStringSize() {
readLock.lock();
try {
final Mean mean = new Mean();
for (StateVertex state : sfg.vertexSet()) {
mean.increment(state.getDom().getBytes().length);
}
return (int) mean.getResult();
} finally {
readLock.unlock();
}
}