mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-11-12 13:47:18 +01:00
19 lines
486 B
C++
19 lines
486 B
C++
//
|
|
// HypothesisTesting.cpp
|
|
//
|
|
// Created by Marc Melikyan on 3/10/21.
|
|
//
|
|
|
|
#include "hypothesis_testing.h"
|
|
|
|
namespace MLPP {
|
|
|
|
std::tuple<bool, double> HypothesisTesting::chiSquareTest(std::vector<double> observed, std::vector<double> expected) {
|
|
double df = observed.size() - 1; // These are our degrees of freedom
|
|
double sum = 0;
|
|
for (int i = 0; i < observed.size(); i++) {
|
|
sum += (observed[i] - expected[i]) * (observed[i] - expected[i]) / expected[i];
|
|
}
|
|
}
|
|
|
|
} //namespace MLPP
|