1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
.. currentmodule:: baycomp
Querying posterior distributions
================================
The third way to use the library is to construct and query posterior
distributions.
We construct the posterior distribution by calling the corresponding test
class. If `j48` and `nbc` contain scores from cross validation on a single
data set, we construct the posterior by
>>> posterior = CorrelatedTTest(nbc, j48)
and then compute the probabilities and plot the histogram
>>> posterior.probs()
(0.4145119975061462, 0.5854880024938538)
>>> fig = posterior.plot(names=("nbc", "j48"))
For comparison on multiple data sets we do the same, except that `nbc` and
`j48` must contain average classification accuracies (for sign test and
signed rank test) or a matrix of accuracies (for hierarchical test).
>>> posterior = SignedRankTest(nbc, j48, rope=1)
>>> posterior.probs()
(0.23014, 0.00674, 0.76312)
>>> fig = posterior.plot(names=("nbc", "j48"))
Single data set
---------------
.. autoclass:: baycomp.single.Posterior
:members:
Unlike the posterior for comparisons on multiple data sets, this
distribution is not sampled; probabilities are computed from the
posterior Student distribution.
The class can provide a sample (as 1-dimensional array), but the
sample itself is not used by other methods.
Multiple data sets
------------------
.. autoclass:: baycomp.multiple.Posterior
:members:
|