mirror of
https://github.com/Relintai/pmlpp.git
synced 2025-01-02 16:29:35 +01:00
Register MLPPGaussMarkovChecker to the ClassDB, and fixed warnings.
This commit is contained in:
parent
c060318c6b
commit
0e75773261
@ -8,7 +8,6 @@
|
||||
#include "../stat/stat.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
void MLPPGaussMarkovChecker::checkGMConditions(std::vector<real_t> eps) {
|
||||
bool condition1 = arithmeticMean(eps);
|
||||
bool condition2 = homoscedasticity(eps);
|
||||
@ -22,36 +21,40 @@ void MLPPGaussMarkovChecker::checkGMConditions(std::vector<real_t> eps) {
|
||||
}
|
||||
|
||||
bool MLPPGaussMarkovChecker::arithmeticMean(std::vector<real_t> eps) {
|
||||
MLPPStat stat;
|
||||
MLPPStat stat;
|
||||
if (stat.mean(eps) == 0) {
|
||||
return 1;
|
||||
return true;
|
||||
} else {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool MLPPGaussMarkovChecker::homoscedasticity(std::vector<real_t> eps) {
|
||||
MLPPStat stat;
|
||||
MLPPStat stat;
|
||||
real_t currentVar = (eps[0] - stat.mean(eps)) * (eps[0] - stat.mean(eps)) / eps.size();
|
||||
for (int i = 0; i < eps.size(); i++) {
|
||||
for (uint32_t i = 0; i < eps.size(); i++) {
|
||||
if (currentVar != (eps[i] - stat.mean(eps)) * (eps[i] - stat.mean(eps)) / eps.size()) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MLPPGaussMarkovChecker::exogeneity(std::vector<real_t> eps) {
|
||||
MLPPStat stat;
|
||||
for (int i = 0; i < eps.size(); i++) {
|
||||
for (int j = 0; j < eps.size(); j++) {
|
||||
MLPPStat stat;
|
||||
for (uint32_t i = 0; i < eps.size(); i++) {
|
||||
for (uint32_t j = 0; j < eps.size(); j++) {
|
||||
if (i != j) {
|
||||
if ((eps[i] - stat.mean(eps)) * (eps[j] - stat.mean(eps)) / eps.size() != 0) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MLPPGaussMarkovChecker::_bind_methods() {
|
||||
}
|
||||
|
@ -10,11 +10,14 @@
|
||||
|
||||
#include "core/math/math_defs.h"
|
||||
|
||||
#include "core/object/reference.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class MLPPGaussMarkovChecker : public Reference {
|
||||
GDCLASS(MLPPGaussMarkovChecker, Reference);
|
||||
|
||||
class MLPPGaussMarkovChecker {
|
||||
public:
|
||||
void checkGMConditions(std::vector<real_t> eps);
|
||||
|
||||
@ -22,8 +25,9 @@ public:
|
||||
bool arithmeticMean(std::vector<real_t> eps); // 1) Arithmetic Mean of 0.
|
||||
bool homoscedasticity(std::vector<real_t> eps); // 2) Homoscedasticity
|
||||
bool exogeneity(std::vector<real_t> eps); // 3) Cov of any 2 non-equal eps values = 0.
|
||||
private:
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
|
||||
#endif /* GaussMarkovChecker_hpp */
|
||||
|
@ -35,6 +35,7 @@ SOFTWARE.
|
||||
#include "mlpp/stat/stat.h"
|
||||
#include "mlpp/numerical_analysis/numerical_analysis.h"
|
||||
#include "mlpp/hypothesis_testing/hypothesis_testing.h"
|
||||
#include "mlpp/gauss_markov_checker/gauss_markov_checker.h"
|
||||
|
||||
#include "mlpp/hidden_layer/hidden_layer.h"
|
||||
#include "mlpp/multi_output_layer/multi_output_layer.h"
|
||||
@ -74,6 +75,7 @@ void register_pmlpp_types(ModuleRegistrationLevel p_level) {
|
||||
ClassDB::register_class<MLPPStat>();
|
||||
ClassDB::register_class<MLPPNumericalAnalysis>();
|
||||
ClassDB::register_class<MLPPHypothesisTesting>();
|
||||
ClassDB::register_class<MLPPGaussMarkovChecker>();
|
||||
|
||||
ClassDB::register_class<MLPPHiddenLayer>();
|
||||
ClassDB::register_class<MLPPOutputLayer>();
|
||||
|
Loading…
Reference in New Issue
Block a user