Meaning and conditions
Bernoulli likelihood evaluates observed binary labels under a logistic model. The calculator sums negative log likelihood for the special case of one common p.[1]
Given predictors, pi=σ(β0+xiᵀβ). Conditional independence makes the observed-label probabilities multiply. Taking logarithms turns the product into a sum. Negating it gives the same binary log loss, summed across observations.[1]
The existing Logistic regression article already covers the model transform. This page develops likelihood as a function of parameters with observed data held fixed. The calculator fits no coefficients: it uses one common supplied probability, an intercept-only special case.[1]
Reasoning step by step
- Code each observed event as yi∈{0,1} and hold the data fixed.
- Compute pi from the logistic model; coefficients are the varying quantities.
- Multiply observed-label probabilities only under appropriate conditional independence.
- At common p with k positives among n labels, NLL=−k ln p−(n−k)ln(1−p).
Units, inverses and limits
The calculator requires safe integers n≥1, 0≤k≤n and 0<p<1. It evaluates the observed sequence: a binomial coefficient belongs to the aggregated count probability. NLL is a total, not mean loss or a probability assigned to parameters.[1]
Two fully worked examples
Three positives among five labels
- Given
- n=5, k=3, common p=0.6.
- Find
- Find a fixed sequence likelihood and NLL.
Write both class contributions as a product.
Sum stably using logarithms.
Result: L=0.03456; NLL≈3.365058.
Check: exp(−NLL)=0.03456. Count probability would additionally multiply by 10.
Compare two candidate models
- Given
- n=4, k=3; candidates pA=0.5 and pB=0.75.
- Find
- Identify the higher likelihood.
Compute both products on the same data.
Compare negative logarithms.
Result: B has higher likelihood and lower NLL.
Check: For common p, the interior maximum is at k/n=0.75. This does not prove performance on new data.
Recall the method later with the formula’s flashcards.
11 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Seeing the relationship
Bernoulli likelihood in logistic regression
Free with a Quanta account. Your download stays ready after registration.
Five exercises with solutions
Calculate · Foundation
n=2, k=1 and p=0.5: find NLL.
Show hint
Use the stated definition and check its assumptions.
Learning goal: Calculate total loss.
Rearrange · Application
L=1/16: what is NLL?
Show hint
Use the stated definition and check its assumptions.
Learning goal: Connect product and log scales.
Interpret · Application
For 10 independent repetitions of the same data, how does NLL change?
Show hint
Use the stated definition and check its assumptions.
Learning goal: Distinguish totals and means.
Show solution and calculation
Likelihood becomes L10 and NLL is multiplied by ten.
Mean per-case loss is unchanged.
Error analysis · Application
Someone multiplies by n choose k for one fixed observed label sequence. Is this required?
Show hint
Use the stated definition and check its assumptions.
Learning goal: Specify the observed event.
Show solution and calculation
No.
That factor counts different sequences with the same positive count.
It belongs to count probability, not this particular sequence.
Transfer · Challenge
For 0<k<n derive the best common p by differentiating NLL.
Show hint
Use the stated definition and check its assumptions.
Learning goal: Derive the intercept-only estimator.
Show solution and calculation
NLL′=−k/p+(n−k)/(1−p)=0 gives p=k/n.
The second derivative k/p2+(n−k)/(1−p)2 is positive.
Check your understanding with the formula’s reference test.
8 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Continue learning
Connect this calculation to binary log loss and logistic regression.
Sources for this explanation
Quanta · Updated November 9, 2026
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Added a full article with original DE/EN examples, exercises, models and source checks.
Cite this reference page
Quanta. Logistic regression as a Bernoulli likelihood. Updated November 9, 2026. https://quanta-study.de/en/formula-sheet/logistische-regression-bernoulli-likelihood
When citing a specific scientific statement, also cite the specialist source linked to that statement.