RenatoGeh / gospn

A free, open-source inference and learning library for Sum-Product Networks (SPN)
BSD 3-Clause "New" or "Revised" License
23 stars 5 forks source link

Implement Fisher's Exact Test #20

Open RenatoGeh opened 5 years ago

RenatoGeh commented 5 years ago

Fisher's exact test is a contingency table variable independence test ideal for small sized datasets. GoSPN currently implements Pearson's Chi-Square test and the G-test, both of which provide approximations that are quite bad on smaller sample sizes. Since LearnSPN recursively splits data at each step downsizing samples potentially in an exponential rate, an exact test is preferred.

There are, as of yet (and as far as I know), no implementation of the Fisher exact test for the general mxn contingency table in Go, C or C++. I have found implementations in R and Python, though I'm not sure the latter is correctly implemented (we should definitely implement unit tests here).

The test itself should be placed at utils/indep/fisher.go, and its unit test under utils/indep/fisher_test.go.