diff options
| author | Tom Harley | 2019-01-29 19:12:22 +0000 |
|---|---|---|
| committer | Tom Harley | 2019-01-29 19:12:22 +0000 |
| commit | 7b4f42242d277adeaec7a40eaac7d178141d4621 (patch) | |
| tree | eacece268545df914d730ad80d6a1b69f1448296 /solvitaire/src/main/evaluation/binomial_ci.cpp | |
| parent | Add support for reading gamestates from json files (diff) | |
| download | metasol-7b4f42242d277adeaec7a40eaac7d178141d4621.tar.gz metasol-7b4f42242d277adeaec7a40eaac7d178141d4621.zip | |
Reorganise submodules (and submodulise solvitaire)
The submodules should now point to repos I’ve made in order to produce static libraries from them. Also, solvitaire now points to a similar personal repo.
Diffstat (limited to 'solvitaire/src/main/evaluation/binomial_ci.cpp')
| m--------- | solvitaire | 0 | ||||
| -rw-r--r-- | solvitaire/src/main/evaluation/binomial_ci.cpp | 45 |
2 files changed, 0 insertions, 45 deletions
diff --git a/solvitaire b/solvitaire new file mode 160000 +Subproject b835e10bfb21a73b4f89e09ddeb400f41538483 diff --git a/solvitaire/src/main/evaluation/binomial_ci.cpp b/solvitaire/src/main/evaluation/binomial_ci.cpp deleted file mode 100644 index c381c05..0000000 --- a/solvitaire/src/main/evaluation/binomial_ci.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -// Created by thecharlesblake on 20/06/18. -// - -#include <cmath> -#include <algorithm> -#include "binomial_ci.h" - -using std::pow; -using std::min; -using std::max; -using std::pair; - -pair<double, double> binomial_ci::wilson(int s_, int f_) { - auto s = static_cast<double>(s_); - auto f = static_cast<double>(f_); - double z = 1.96; - double z2 = pow(z, 2); - double n = s + f; - double p = (s + (z2 / 2.0)) / (n + z2); - double half_ci = (z / (n + z2)) * sqrt(((s * f) / n) + (z2 / 4.0)); - return { p - half_ci - , p + half_ci }; -} - -pair<double, double> binomial_ci::wilson(int s, int f, int i) { - pair<double, double> a = wilson(s, f + i); - pair<double, double> b = wilson(s + i, f); - return {a.first, b.second}; -} - -pair<double, double> binomial_ci::agresti_coull(int s, int f) { - double z = 1.96; - double n_ = s + f + pow(z, 2); - double p = (s + pow(z, 2)/2)/n_; - double half_ci = z * sqrt((p - pow(p, 2))/n_); - return { max(0.0, p - half_ci) - , min(1.0, p + half_ci) }; -} - -pair<double, double> binomial_ci::agresti_coull(int s, int f, int i) { - pair<double, double> a = agresti_coull(s, f + i); - pair<double, double> b = agresti_coull(s + i, f); - return {a.first, b.second}; -} |
