pmlpp/mlpp/stat/stat.h

71 lines
2.5 KiB
C
Raw Normal View History

2023-01-24 18:57:18 +01:00
#ifndef MLPP_STAT_H
#define MLPP_STAT_H
//
// Stat.hpp
//
// Created by Marc Melikyan on 9/29/20.
//
2023-01-27 13:01:16 +01:00
#include "core/math/math_defs.h"
2023-02-12 15:47:48 +01:00
#include "core/object/reference.h"
2023-02-08 01:26:37 +01:00
#include "../lin_alg/mlpp_matrix.h"
#include "../lin_alg/mlpp_vector.h"
2023-02-08 01:26:37 +01:00
#include <vector>
2023-01-24 19:20:18 +01:00
2023-02-12 15:47:48 +01:00
class MLPPStat : public Reference {
GDCLASS(MLPPStat, Reference);
2023-01-24 19:00:54 +01:00
public:
// These functions are for univariate lin reg module- not for users.
2023-01-27 13:01:16 +01:00
real_t b0Estimation(const std::vector<real_t> &x, const std::vector<real_t> &y);
real_t b1Estimation(const std::vector<real_t> &x, const std::vector<real_t> &y);
2023-02-09 02:27:04 +01:00
real_t b0_estimation(const Ref<MLPPVector> &x, const Ref<MLPPVector> &y);
real_t b1_estimation(const Ref<MLPPVector> &x, const Ref<MLPPVector> &y);
2023-01-24 19:00:54 +01:00
// Statistical Functions
2023-01-27 13:01:16 +01:00
real_t mean(const std::vector<real_t> &x);
real_t median(std::vector<real_t> x);
std::vector<real_t> mode(const std::vector<real_t> &x);
real_t range(const std::vector<real_t> &x);
real_t midrange(const std::vector<real_t> &x);
real_t absAvgDeviation(const std::vector<real_t> &x);
real_t standardDeviation(const std::vector<real_t> &x);
real_t variance(const std::vector<real_t> &x);
real_t covariance(const std::vector<real_t> &x, const std::vector<real_t> &y);
real_t correlation(const std::vector<real_t> &x, const std::vector<real_t> &y);
real_t R2(const std::vector<real_t> &x, const std::vector<real_t> &y);
real_t chebyshevIneq(const real_t k);
2023-01-24 19:00:54 +01:00
2023-02-08 01:26:37 +01:00
real_t meanv(const Ref<MLPPVector> &x);
2023-02-09 15:30:33 +01:00
real_t standard_deviationv(const Ref<MLPPVector> &x);
2023-02-09 02:27:04 +01:00
real_t variancev(const Ref<MLPPVector> &x);
2023-02-08 01:26:37 +01:00
real_t covariancev(const Ref<MLPPVector> &x, const Ref<MLPPVector> &y);
2023-01-24 19:00:54 +01:00
// Extras
2023-01-27 13:01:16 +01:00
real_t weightedMean(const std::vector<real_t> &x, const std::vector<real_t> &weights);
real_t geometricMean(const std::vector<real_t> &x);
real_t harmonicMean(const std::vector<real_t> &x);
real_t RMS(const std::vector<real_t> &x);
real_t powerMean(const std::vector<real_t> &x, const real_t p);
real_t lehmerMean(const std::vector<real_t> &x, const real_t p);
real_t weightedLehmerMean(const std::vector<real_t> &x, const std::vector<real_t> &weights, const real_t p);
real_t contraHarmonicMean(const std::vector<real_t> &x);
real_t heronianMean(const real_t A, const real_t B);
real_t heinzMean(const real_t A, const real_t B, const real_t x);
real_t neumanSandorMean(const real_t a, const real_t b);
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);
2023-02-12 15:47:48 +01:00
protected:
static void _bind_methods();
2023-01-24 19:00:54 +01:00
};
2023-01-24 19:20:18 +01:00
#endif /* Stat_hpp */