for (int i = 0; i < 40; i++) {
s.add(5.0);
} double p2 = predictor.predict(&s);
ASSERT_NEAR(p2, 5.0, epsilon);
}
// The following tests checks that the initial predictions are based on // the average of the sequence and not on the stddev (which is 0).
TEST_VM(G1Predictions, average_not_stdev_predictions) {
G1Predictions predictor(0.5);
TruncatedSeq s;
s.add(1.0); double p1 = predictor.predict(&s);
ASSERT_GT(p1, s.davg()) << "First prediction must be greater than average";
s.add(1.0); double p2 = predictor.predict(&s);
ASSERT_GT(p1, p2) << "First prediction must be greater than second";
s.add(1.0); double p3 = predictor.predict(&s);
ASSERT_GT(p2, p3) << "Second prediction must be greater than third";
s.add(1.0);
s.add(1.0); // Five elements are now in the sequence. double p4 = predictor.predict(&s);
ASSERT_LT(p4, p3) << "Fourth prediction must be smaller than third";
ASSERT_NEAR(p4, 1.0, epsilon);
}
// The following tests checks that initially prediction based on // the average is used, that gets overridden by the stddev prediction at // the end.
TEST_VM(G1Predictions, average_stdev_predictions) {
G1Predictions predictor(0.5);
TruncatedSeq s;
s.add(0.5); double p1 = predictor.predict(&s);
ASSERT_GT(p1, s.davg()) << "First prediction must be greater than average";
s.add(0.2); double p2 = predictor.predict(&s);
ASSERT_GT(p1, p2) << "First prediction must be greater than second";
s.add(0.5); double p3 = predictor.predict(&s);
ASSERT_GT(p2, p3) << "Second prediction must be greater than third";
s.add(0.2);
s.add(2.0); double p4 = predictor.predict(&s);
ASSERT_GT(p4, p3) << "Fourth prediction must be greater than third";
}
// Some tests to verify bounding between [0 .. 1]
TEST_VM(G1Predictions, unit_predictions) {
G1Predictions predictor(0.5);
TruncatedSeq s;
double p0 = predictor.predict_in_unit_interval(&s);
ASSERT_LT(p0, epsilon) << "Initial prediction of empty sequence must be 0.0";
// Feed the sequence additional positive values to test the high bound. for (int i = 0; i < 3; i++) {
s.add(2.0);
}
ASSERT_NEAR(predictor.predict_in_unit_interval(&s), 1.0, epsilon);
// Feed the sequence additional large negative value to test the low bound. for (int i = 0; i < 4; i++) {
s.add(-200.0);
}
ASSERT_NEAR(predictor.predict_in_unit_interval(&s), 0.0, epsilon);
}
// Some tests to verify bounding between [0 .. +inf]
TEST_VM(G1Predictions, lower_bound_zero_predictions) {
G1Predictions predictor(0.5);
TruncatedSeq s;
double p0 = predictor.predict_zero_bounded(&s);
ASSERT_LT(p0, epsilon) << "Initial prediction of empty sequence must be 0.0";
s.add(100.0); // Feed the sequence additional positive values to see that the high bound is not // bounded by e.g. 1.0 for (int i = 0; i < 3; i++) {
s.add(2.0);
}
ASSERT_GT(predictor.predict_zero_bounded(&s), 1.0);
// Feed the sequence additional large negative value to test the low bound. for (int i = 0; i < 4; i++) {
s.add(-200.0);
}
ASSERT_NEAR(predictor.predict_zero_bounded(&s), 0.0, epsilon);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.