mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-11-08 13:12:09 +01:00
Re-enabled statistics tests.
This commit is contained in:
parent
4b7e133753
commit
d35526be73
@ -77,43 +77,45 @@ void MLPPTests::test_statistics() {
|
||||
MLPPConvolutions conv;
|
||||
|
||||
// STATISTICS
|
||||
std::vector<real_t> x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
std::vector<real_t> y = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
|
||||
std::vector<real_t> w = { 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 };
|
||||
const real_t x_arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
const real_t y_arr[] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
|
||||
const real_t w_arr[] = { 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 };
|
||||
|
||||
/*
|
||||
is_approx_equalsd(stat.mean(x), 5.5, "Arithmetic Mean");
|
||||
is_approx_equalsd(stat.mean(x), 5.5, "Median");
|
||||
Ref<MLPPVector> x = memnew(MLPPVector(x_arr, 10));
|
||||
Ref<MLPPVector> y = memnew(MLPPVector(y_arr, 10));
|
||||
Ref<MLPPVector> w = memnew(MLPPVector(w_arr, 10));
|
||||
|
||||
is_approx_equals_dvec(dstd_vec_to_vec(stat.mode(x)), dstd_vec_to_vec(x), "stat.mode(x)");
|
||||
is_approx_equalsd(stat.meanv(x), 5.5, "Arithmetic Mean");
|
||||
is_approx_equalsd(stat.meanv(x), 5.5, "Median");
|
||||
|
||||
is_approx_equals_vec(stat.mode(x), x, "stat.mode(x)");
|
||||
|
||||
is_approx_equalsd(stat.range(x), 9, "Range");
|
||||
is_approx_equalsd(stat.midrange(x), 4.5, "Midrange");
|
||||
is_approx_equalsd(stat.absAvgDeviation(x), 2.5, "Absolute Average Deviation");
|
||||
is_approx_equalsd(stat.standardDeviation(x), 3.02765, "Standard Deviation");
|
||||
is_approx_equalsd(stat.variance(x), 9.16667, "Variance");
|
||||
is_approx_equalsd(stat.covariance(x, y), -9.16667, "Covariance");
|
||||
is_approx_equalsd(stat.abs_avg_deviation(x), 2.5, "Absolute Average Deviation");
|
||||
is_approx_equalsd(stat.standard_deviationv(x), 3.02765, "Standard Deviation");
|
||||
is_approx_equalsd(stat.variancev(x), 9.16667, "Variance");
|
||||
is_approx_equalsd(stat.covariancev(x, y), -9.16667, "Covariance");
|
||||
is_approx_equalsd(stat.correlation(x, y), -1, "Correlation");
|
||||
is_approx_equalsd(stat.R2(x, y), 1, "R^2");
|
||||
is_approx_equalsd(stat.r2(x, y), 1, "R^2");
|
||||
|
||||
// Returns 1 - (1/k^2)
|
||||
is_approx_equalsd(stat.chebyshevIneq(2), 0.75, "Chebyshev Inequality");
|
||||
is_approx_equalsd(stat.weightedMean(x, w), 5.5, "Weighted Mean");
|
||||
is_approx_equalsd(stat.geometricMean(x), 4.52873, "Geometric Mean");
|
||||
is_approx_equalsd(stat.harmonicMean(x), 3.41417, "Harmonic Mean");
|
||||
is_approx_equalsd(stat.RMS(x), 6.20484, "Root Mean Square (Quadratic mean)");
|
||||
is_approx_equalsd(stat.powerMean(x, 5), 7.39281, "Power Mean (p = 5)");
|
||||
is_approx_equalsd(stat.lehmerMean(x, 5), 8.71689, "Lehmer Mean (p = 5)");
|
||||
is_approx_equalsd(stat.weightedLehmerMean(x, w, 5), 8.71689, "Weighted Lehmer Mean (p = 5)");
|
||||
is_approx_equalsd(stat.contraHarmonicMean(x), 7, "Contraharmonic Mean");
|
||||
is_approx_equalsd(stat.heronianMean(1, 10), 4.72076, "Hernonian Mean");
|
||||
is_approx_equalsd(stat.heinzMean(1, 10, 1), 5.5, "Heinz Mean (x = 1)");
|
||||
is_approx_equalsd(stat.neumanSandorMean(1, 10), 3.36061, "Neuman-Sandor Mean");
|
||||
is_approx_equalsd(stat.stolarskyMean(1, 10, 5), 6.86587, "Stolarsky Mean (p = 5)");
|
||||
is_approx_equalsd(stat.identricMean(1, 10), 4.75135, "Identric Mean");
|
||||
is_approx_equalsd(stat.logMean(1, 10), 3.90865, "Logarithmic Mean");
|
||||
is_approx_equalsd(stat.absAvgDeviation(x), 2.5, "Absolute Average Deviation");
|
||||
*/
|
||||
is_approx_equalsd(stat.chebyshev_ineq(2), 0.75, "Chebyshev Inequality");
|
||||
is_approx_equalsd(stat.weighted_mean(x, w), 5.5, "Weighted Mean");
|
||||
is_approx_equalsd(stat.geometric_mean(x), 4.52873, "Geometric Mean");
|
||||
is_approx_equalsd(stat.harmonic_mean(x), 3.41417, "Harmonic Mean");
|
||||
is_approx_equalsd(stat.rms(x), 6.20484, "Root Mean Square (Quadratic mean)");
|
||||
is_approx_equalsd(stat.power_mean(x, 5), 7.39281, "Power Mean (p = 5)");
|
||||
is_approx_equalsd(stat.lehmer_mean(x, 5), 8.71689, "Lehmer Mean (p = 5)");
|
||||
is_approx_equalsd(stat.weighted_lehmer_mean(x, w, 5), 8.71689, "Weighted Lehmer Mean (p = 5)");
|
||||
is_approx_equalsd(stat.contra_harmonic_mean(x), 7, "Contraharmonic Mean");
|
||||
is_approx_equalsd(stat.heronian_mean(1, 10), 4.72076, "Hernonian Mean");
|
||||
is_approx_equalsd(stat.heinz_mean(1, 10, 1), 5.5, "Heinz Mean (x = 1)");
|
||||
is_approx_equalsd(stat.neuman_sandor_mean(1, 10), 3.36061, "Neuman-Sandor Mean");
|
||||
is_approx_equalsd(stat.stolarsky_mean(1, 10, 5), 6.86587, "Stolarsky Mean (p = 5)");
|
||||
is_approx_equalsd(stat.identric_mean(1, 10), 4.75135, "Identric Mean");
|
||||
is_approx_equalsd(stat.log_mean(1, 10), 3.90865, "Logarithmic Mean");
|
||||
is_approx_equalsd(stat.abs_avg_deviation(x), 2.5, "Absolute Average Deviation");
|
||||
|
||||
ERR_PRINT("MLPPTests::test_statistics() Finished!");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user