mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-11-08 13:12:09 +01:00
Added MLPPHypothesisTestingOld.
This commit is contained in:
parent
0f5bf88e33
commit
478044e7b3
1
SCsub
1
SCsub
@ -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",
|
||||
]
|
||||
|
20
mlpp/hypothesis_testing/hypothesis_testing_old.cpp
Normal file
20
mlpp/hypothesis_testing/hypothesis_testing_old.cpp
Normal 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() {
|
||||
}
|
28
mlpp/hypothesis_testing/hypothesis_testing_old.h
Normal file
28
mlpp/hypothesis_testing/hypothesis_testing_old.h
Normal 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 */
|
Loading…
Reference in New Issue
Block a user