Prior Probability Calculator

Estimate class priors, compare smoothing methods, analyse imbalance, update probabilities with evidence, and export clear machine learning results for practical modelling decisions and evaluation.

Calculation Settings

Choose how class priors are estimated.
Laplace usually uses one. Jeffreys uses one-half.

Bayesian Update Options

Automatic evidence sums prior times likelihood.
Used only when manual evidence is selected.
Enter each likelihood inside the class table below.

Class Data

Add names, counts, custom priors, likelihoods, and weights.
Class name Observations Custom prior Likelihood P(E|C) Weight Actions
Live totals 0 0 0 0

Import and Bulk Input

Columns: class, count, custom_prior, likelihood, weight.

Formula Used

Empirical prior: P(Ci) = Ni / N
Smoothed prior: P(Ci) = (Ni + α) / (N + αK)
Balanced weight: wi = N / (K × Ni)
Bayes update: P(Ci|E) = P(E|Ci)P(Ci) / P(E)
Entropy: H(C) = −Σ P(Ci) log2P(Ci)

The empirical prior uses observed class frequencies. Smoothing protects classes with few or zero samples. Bayesian updating combines each prior with supplied evidence.

How to Use the Calculator

  1. Select an empirical, uniform, custom, or smoothed method.
  2. Add every class and enter its observation count.
  3. Provide custom priors only when custom mode is selected.
  4. Enter likelihood values to calculate posterior probabilities.
  5. Choose automatic or manual evidence probability handling.
  6. Calculate, review warnings, compare charts, and export results.

Example Data

Class Observations Empirical prior Likelihood
Positive3000.600.80
Negative2000.400.25
Total5001.00

Frequently Asked Questions

What is prior probability?

Prior probability describes belief before new evidence appears. It may use frequencies or expert assumptions. The value becomes input for later Bayesian updating.

When should I use empirical priors?

Use empirical priors when historical labels represent deployment conditions. They reflect observed class proportions directly. Review sampling bias before trusting their practical meaning.

What does a uniform prior mean?

A uniform prior gives every class equal probability. It ignores observed class frequency differences. This choice suits limited or deliberately neutral information.

Why use Laplace smoothing?

Laplace smoothing adds pseudo-counts to every class. It prevents exact zero prior probabilities. This improves stability when some classes appear rarely.

What is the Jeffreys prior?

The Jeffreys option uses one-half as pseudo-count. It is weaker than standard Laplace smoothing. The method often reduces stronger uniform assumptions.

Must custom priors sum to one?

Valid class priors normally sum exactly to one. Small rounding differences may still occur. Automatic normalisation converts positive values into valid proportions.

How is class imbalance measured?

The calculator compares largest and smallest positive counts. Larger ratios indicate stronger class imbalance. Zero-count classes require smoothing or additional training data.

How are posterior probabilities calculated?

Each prior is multiplied by its likelihood. Automatic evidence sums those weighted likelihoods. Dividing each numerator produces updated posterior probabilities.

What does prior entropy show?

Entropy measures uncertainty across the prior distribution. Higher values indicate more evenly distributed probabilities. Lower values indicate concentration within fewer classes.

Related Calculators

Posterior Probability CalculatorGaussian Probability Density CalculatorMaximum Likelihood Estimation CalculatorBayesian Information Criterion CalculatorAkaike Information Criterion Calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.