Added MLPPHypothesisTestingOld.

This commit is contained in:
Relintai 2023-02-13 17:29:02 +01:00
parent 0f5bf88e33
commit 478044e7b3
3 changed files with 49 additions and 0 deletions

1
SCsub
View File

@ -82,6 +82,7 @@ sources = [
"mlpp/transforms/transforms_old.cpp",
"mlpp/stat/stat_old.cpp",
"mlpp/lin_alg/lin_alg_old.cpp",
"mlpp/hypothesis_testing/hypothesis_testing_old.cpp",
"test/mlpp_tests.cpp",
]

View File

@ -0,0 +1,20 @@
//
// HypothesisTesting.cpp
//
// Created by Marc Melikyan on 3/10/21.
//
#include "hypothesis_testing_old.h"
std::tuple<bool, real_t> MLPPHypothesisTestingOld::chiSquareTest(std::vector<real_t> observed, std::vector<real_t> expected) {
//real_t df = observed.size() - 1; // These are our degrees of freedom
real_t sum = 0;
for (uint32_t i = 0; i < observed.size(); i++) {
sum += (observed[i] - expected[i]) * (observed[i] - expected[i]) / expected[i];
}
return std::tuple<bool, real_t>();
}
void MLPPHypothesisTestingOld::_bind_methods() {
}

View File

@ -0,0 +1,28 @@
#ifndef MLPP_HYPOTHESIS_TESTING_OLD_H
#define MLPP_HYPOTHESIS_TESTING_OLD_H
//
// HypothesisTesting.hpp
//
// Created by Marc Melikyan on 3/10/21.
//
#include "core/math/math_defs.h"
#include "core/object/reference.h"
#include <tuple>
#include <vector>
class MLPPHypothesisTestingOld : public Reference {
GDCLASS(MLPPHypothesisTestingOld, Reference);
public:
std::tuple<bool, real_t> chiSquareTest(std::vector<real_t> observed, std::vector<real_t> expected);
protected:
static void _bind_methods();
};
#endif /* HypothesisTesting_hpp */