diff --git a/mlpp/stat/stat_old.cpp b/mlpp/stat/stat_old.cpp index a493819..3450db6 100644 --- a/mlpp/stat/stat_old.cpp +++ b/mlpp/stat/stat_old.cpp @@ -22,13 +22,6 @@ real_t MLPPStatOld::b1Estimation(const std::vector &x, const std::vector return covariance(x, y) / variance(x); } -real_t MLPPStatOld::b0_estimation(const Ref &x, const Ref &y) { - return meanv(y) - b1_estimation(x, y) * meanv(x); -} -real_t MLPPStatOld::b1_estimation(const Ref &x, const Ref &y) { - return covariancev(x, y) / variancev(x); -} - real_t MLPPStatOld::mean(const std::vector &x) { real_t sum = 0; for (uint32_t i = 0; i < x.size(); i++) { @@ -121,56 +114,6 @@ real_t MLPPStatOld::chebyshevIneq(const real_t k) { return 1 - 1 / (k * k); } -real_t MLPPStatOld::meanv(const Ref &x) { - int x_size = x->size(); - const real_t *x_ptr = x->ptr(); - - real_t sum = 0; - for (int i = 0; i < x_size; ++i) { - sum += x_ptr[i]; - } - - return sum / x_size; -} - -real_t MLPPStatOld::standard_deviationv(const Ref &x) { - return Math::sqrt(variancev(x)); -} - -real_t MLPPStatOld::variancev(const Ref &x) { - real_t x_mean = meanv(x); - - int x_size = x->size(); - const real_t *x_ptr = x->ptr(); - - real_t sum = 0; - for (int i = 0; i < x_size; ++i) { - real_t xi = x_ptr[i]; - - sum += (xi - x_mean) * (xi - x_mean); - } - return sum / (x_size - 1); -} - -real_t MLPPStatOld::covariancev(const Ref &x, const Ref &y) { - ERR_FAIL_COND_V(x->size() != y->size(), 0); - - real_t x_mean = meanv(x); - real_t y_mean = meanv(y); - - int x_size = x->size(); - const real_t *x_ptr = x->ptr(); - const real_t *y_ptr = y->ptr(); - - real_t sum = 0; - - for (int i = 0; i < x_size; ++i) { - sum += (x_ptr[i] - x_mean) * (y_ptr[i] - y_mean); - } - - return sum / (x_size - 1); -} - real_t MLPPStatOld::weightedMean(const std::vector &x, const std::vector &weights) { real_t sum = 0; real_t weights_sum = 0; @@ -270,6 +213,3 @@ real_t MLPPStatOld::logMean(const real_t x, const real_t y) { } return (y - x) / (log(y) - std::log(x)); } - -void MLPPStatOld::_bind_methods() { -} diff --git a/mlpp/stat/stat_old.h b/mlpp/stat/stat_old.h index 14a795a..d477736 100644 --- a/mlpp/stat/stat_old.h +++ b/mlpp/stat/stat_old.h @@ -10,24 +10,14 @@ #include "core/math/math_defs.h" -#include "core/object/reference.h" - -#include "../lin_alg/mlpp_matrix.h" -#include "../lin_alg/mlpp_vector.h" - #include -class MLPPStatOld : public Reference { - GDCLASS(MLPPStatOld, Reference); - +class MLPPStatOld { public: // These functions are for univariate lin reg module- not for users. real_t b0Estimation(const std::vector &x, const std::vector &y); real_t b1Estimation(const std::vector &x, const std::vector &y); - real_t b0_estimation(const Ref &x, const Ref &y); - real_t b1_estimation(const Ref &x, const Ref &y); - // Statistical Functions real_t mean(const std::vector &x); real_t median(std::vector x); @@ -42,11 +32,6 @@ public: real_t R2(const std::vector &x, const std::vector &y); real_t chebyshevIneq(const real_t k); - real_t meanv(const Ref &x); - real_t standard_deviationv(const Ref &x); - real_t variancev(const Ref &x); - real_t covariancev(const Ref &x, const Ref &y); - // Extras real_t weightedMean(const std::vector &x, const std::vector &weights); real_t geometricMean(const std::vector &x); @@ -62,9 +47,6 @@ public: real_t stolarskyMean(const real_t x, const real_t y, const real_t p); real_t identricMean(const real_t x, const real_t y); real_t logMean(const real_t x, const real_t y); - -protected: - static void _bind_methods(); }; #endif /* Stat_hpp */