Note that there are some explanatory texts on larger screens.

plurals
  1. POCalculate posterior distribution of unknown mis-classification with PRTools in MATLAB
    text
    copied!<p>I'm using the <a href="http://prtools.org/" rel="nofollow noreferrer">PRTools</a> MATLAB library to train some classifiers, generating test data and testing the classifiers. </p> <p>I have the following details:</p> <ul> <li>N: Total # of test examples </li> <li>k: # of mis-classification for each classifier and class</li> </ul> <p>I want to do:</p> <p>Calculate and plot Bayesian posterior distributions of the unknown probabilities of mis-classification (denoted q), that is, as probability density functions over q itself (so, P(q) will be plotted over q, from 0 to 1).</p> <p>I have that (math formulae, not matlab code!):</p> <pre><code>Posterior = Likelihood * Prior / Normalization constant = P(q|k,N) = P(k|q,N) * P(q|N) / P(k|N) </code></pre> <p>The prior is set to 1, so I only need to calculate the likelihood and normalization constant. </p> <p>I know that the likelihood can be expressed as (where B(N,k) is the binomial coefficient):</p> <pre><code>P(k|q,N) = B(N,k) * q^k * (1-q)^(N-k) </code></pre> <p>... so the Normalization constant is simply an integral of the posterior above, from 0 to 1:</p> <pre><code>P(k|N) = B(N,k) * integralFromZeroToOne( q^k * (1-q)^(N-k) ) </code></pre> <p>(The Binomial coefficient ( B(N,k) ) can be omitted though as it appears in both the likelihood and normalization constant)</p> <p>Now, I've heard that the integral for the normalization constant should be able to be calculated as a series ... something like:</p> <pre><code>k!(N-k)! / (N+1)! </code></pre> <p>Is that correct? (I have some lecture notes with this series, but can't figure out if it is for the normalization constant integral, or for the overall distribution of mis-classification (q))</p> <p>Also, hints are welcome as how to practically calculate this? (factorials are easily creating truncation errors right?) ... AND, how to practically calculate the final plot (the posterior distribution over q, from 0 to 1).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload