Java Code Examples for java.util.DoubleSummaryStatistics#getCount()

The following examples show how to use java.util.DoubleSummaryStatistics#getCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModelRunner.java    From SLP-Core with MIT License 5 votes vote down vote up
private void logModelingProgress(List<Double> modeled) {
	DoubleSummaryStatistics stats = modeled.stream().skip(1)
			.mapToDouble(Double::doubleValue).summaryStatistics();
	long prevCount = this.modelStats[0];
	this.modelStats[0] += stats.getCount();
	this.ent += stats.getSum();
	if (this.modelStats[0] / this.MODEL_PRINT_INTERVAL > prevCount / this.MODEL_PRINT_INTERVAL
			&& this.modelStats[1] != 0) {
		System.out.printf("Modeling: %dK tokens processed in %ds, avg. entropy: %.4f\n",
				Math.round(this.modelStats[0]/1e3),
				(System.currentTimeMillis() + this.modelStats[1])/1000, this.ent/this.modelStats[0]);
	}
}
 
Example 2
Source File: ModelRunner.java    From SLP-Core with MIT License 5 votes vote down vote up
private void logPredictionProgress(List<Double> modeled) {
	DoubleSummaryStatistics stats = modeled.stream().skip(1)
			.mapToDouble(Double::doubleValue).summaryStatistics();
	long prevCount = this.modelStats[0];
	this.modelStats[0] += stats.getCount();
	this.mrr += stats.getSum();
	if (this.modelStats[0] / this.MODEL_PRINT_INTERVAL > prevCount / this.MODEL_PRINT_INTERVAL
			&& this.modelStats[1] != 0) {
		System.out.printf("Predicting: %dK tokens processed in %ds, avg. MRR: %.4f\n",
				Math.round(this.modelStats[0]/1e3),
				(System.currentTimeMillis() + this.modelStats[1])/1000, this.mrr/this.modelStats[0]);
	}
}
 
Example 3
Source File: ModelRunner.java    From SLP-Core with MIT License 5 votes vote down vote up
private void logCompletionProgress(List<Completion> completions) {
	DoubleSummaryStatistics stats = completions.stream().skip(1)
			.map(Completion::getRank)
			.mapToDouble(ModelRunner::toMRR)
			.summaryStatistics();
	long prevCount = this.modelStats[0];
	this.modelStats[0] += stats.getCount();
	this.mrr += stats.getSum();
	if (this.modelStats[0] / this.MODEL_PRINT_INTERVAL > prevCount / this.MODEL_PRINT_INTERVAL
			&& this.modelStats[1] != 0) {
		System.out.printf("Predicting: %dK tokens processed in %ds, avg. MRR: %.4f\n",
				Math.round(this.modelStats[0]/1e3),
				(System.currentTimeMillis() + this.modelStats[1])/1000, this.mrr/this.modelStats[0]);
	}
}
 
Example 4
Source File: DoubleSummary.java    From jenetics with Apache License 2.0 5 votes vote down vote up
/**
 * Return a new value object of the statistical summary, currently
 * represented by the {@code statistics} object.
 *
 * @param statistics the creating (mutable) statistics class
 * @return the statistical moments
 */
public static DoubleSummary of(final DoubleSummaryStatistics statistics) {
	return new DoubleSummary(
		statistics.getCount(),
		statistics.getMin(),
		statistics.getMax(),
		statistics.getSum(),
		statistics.getAverage()
	);
}