Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 846707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:39:34+00:00 2026-05-15T06:39:34+00:00

I’m using the PRTools MATLAB library to train some classifiers, generating test data and

  • 0

I’m using the PRTools MATLAB library to train some classifiers, generating test data and testing the classifiers.

I have the following details:

  • N: Total # of test examples
  • k: # of
    mis-classification for each
    classifier and class

I want to do:

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).

I have that (math formulae, not matlab code!):

Posterior = Likelihood * Prior  / Normalization constant = 
P(q|k,N)  = P(k|q,N)   * P(q|N) / P(k|N)

The prior is set to 1, so I only need to calculate the likelihood and normalization constant.

I know that the likelihood can be expressed as (where B(N,k) is the binomial coefficient):

P(k|q,N) = B(N,k) * q^k * (1-q)^(N-k)

… so the Normalization constant is simply an integral of the posterior above, from 0 to 1:

P(k|N) = B(N,k) * integralFromZeroToOne( q^k * (1-q)^(N-k) )

(The Binomial coefficient ( B(N,k) ) can be omitted though as it appears in both the likelihood and normalization constant)

Now, I’ve heard that the integral for the normalization constant should be able to be calculated as a series … something like:

k!(N-k)! / (N+1)!

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))

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).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:39:34+00:00Added an answer on May 15, 2026 at 6:39 am

    I really haven’t done much with Bayesian posterior distributions ( and not for a while), but I’ll try to help with what you’ve given. First,

    k!(N-k)! / (N+1)! = 1 / (B(N,k) * (N + 1))
    

    and you can calculate the binomial coefficients in Matlab with nchoosek() though it does say in the docs that there can be accuracy problems for large coefficients. How big are N and k?

    Second, according to Mathematica,

    integralFromZeroToOne( q^k * (1-q)^(N-k) ) = pi * csc((k-N)*pi) * Gamma(1+k)/(Gamma(k-N) * Gamma(2+N))
    

    where csc() is the cosecant function and Gamma() is the gamma function. However, Gamma(x) = (x-1)! which we’ll use in a moment. The problem is that we have a function Gamma(k-N) on the bottom and k-N will be negative. However, the reflection formula will help us with that so that we end up with:

    = (N-k)! * k! / (N+1)!
    

    Apparently, your notes were correct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 486k
  • Answers 486k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Just found out in my case its fine to use… May 16, 2026 at 7:55 am
  • Editorial Team
    Editorial Team added an answer This is actually just a UIActionSheet. You can create one… May 16, 2026 at 7:55 am
  • Editorial Team
    Editorial Team added an answer If you don't have VS2010, you can use PostSharp to… May 16, 2026 at 7:55 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.