Opening your learning space
Starting the app …
Opening your learning space
Starting the app …
Cross-entropy scores how well a predicted probability distribution q matches a target distribution p over classes.
Free to browse · flashcards or a multiple-choice quiz · import from Essential
Formula
Nats (the natural logarithm ln is used, as in scikit-learn log_loss)
| Symbol | Meaning | Unit |
|---|---|---|
| Target probability for class i | dimensionless | |
| Model-predicted probability for class i | dimensionless | |
| Number of classes | count |
H(p,q)=-\sum_{i=1}^{K}p_i\ln q_iFor one-hot labels, only the true class contributes, so the loss is −ln of its predicted probability. Confidently assigning a small probability to the true class produces a large penalty. If pi>0 while qi=0, the ideal loss is infinite; software typically clips probabilities for numerical stability. This entry consistently uses the natural logarithm, so the information unit is the nat. Cross-entropy differs from Shannon entropy because q represents the model prediction.
For one-hot labels, only the true class contributes, so the loss is −ln of its predicted probability. Confidently assigning a small probability to the true class produces a large penalty. If pi>0 while qi=0, the ideal loss is infinite; software typically clips probabilities for numerical stability. This entry consistently uses the natural logarithm, so the information unit is the nat. Cross-entropy differs from Shannon entropy because q represents the model prediction.
Cross-entropy scores how well a predicted probability distribution q matches a target distribution p over classes.
Defining relation
The equation states the defining relation within its stated domain.
Use the example for Cross-entropy (classification loss) to explain which inputs determine the requested output.
The example connects concrete inputs to its result.
Cross-entropy scores how well a predicted probability distribution q matches a target distribution p over classes.
The relation applies only under its stated assumptions.
Applying the relation to a different case without checking its stated assumptions.
Check the validity range before substituting values: For one-hot labels, only the true class contributes, so the loss is −ln of its predicted probability. Confidently assigning a small probability to the true class produces a large penalty..
Formula cluster
Cross-entropy scores how well a predicted probability distribution q matches a target distribution p over classes.
If the true class receives probability 0.8, natural-log loss is −ln(0.8)≈0.223 nats; at probability 0.1 it rises to about 2.303 nats.
Train probabilistic classifiers and assess predicted distributions with a proper scoring loss.
Here is how to work through a typical Cross-entropy (classification loss) (H(p,q) = −Σ pᵢ ln(qᵢ)) task step by step:
Task
Use the example for Cross-entropy (classification loss) to explain which inputs determine the requested output.
Solution path
The example connects concrete inputs to its result.
Cross-entropy scores how well a predicted probability distribution q matches a target distribution p over classes.
The relation applies only under its stated assumptions.
The relation H(p,q)=-\sum_{i=1}^{K}pi\ln qi summarizes Cross-entropy scores how well a predicted probability distribution q matches a target distribution p over classes. Read it as a model for defined quantities, not as an automatic claim about every real situation. In the example If the true class receives probability 0.8, natural-log loss is −ln(0.8)≈0.223 nats; at probability 0.1 it rises to about 2.303 nats., symbols are connected to concrete values and the result is interpreted in context. Validity limit: For one-hot labels, only the true class contributes, so the loss is −ln of its predicted probability. Confidently assigning a small probability to the true class produces a large penalty. Source: scikit-learn, `log_loss`: binary log loss and cross-entropy definition.
First write down the requested quantity and all given values with their symbols. Substitute them into the defining relation and check unit consistency. The example If the true class receives probability 0.8, natural-log loss is −ln(0.8)≈0.223 nats; at probability 0.1 it rises to about 2.303 nats. provides a worked check: formula and result must have compatible scale and meaning; round only at the end. Validity limit: For one-hot labels, only the true class contributes, so the loss is −ln of its predicted probability. Confidently assigning a small probability to the true class produces a large penalty. Source: scikit-learn, `log_loss`: binary log loss and cross-entropy definition.
The formula applies only when quantities are defined as in the source and background. Check boundary cases, measurement conditions and whether an approximation rather than equality is intended. Substitution can be algebraically correct yet technically wrong when assumptions fail or the population or system boundary changes. Validity limit: For one-hot labels, only the true class contributes, so the loss is −ln of its predicted probability. Confidently assigning a small probability to the true class produces a large penalty. Source: scikit-learn, `log_loss`: binary log loss and cross-entropy definition.
The stated units are: Nats (the natural logarithm ln is used, as in scikit-learn log_loss). Convert values to a consistent unit system before substitution; counts, percentages and dimensionless ratios are not interchangeable. The variable list states the role of each symbol. Dimensional analysis catches many errors but does not replace checking the formula's assumptions. Validity limit: For one-hot labels, only the true class contributes, so the loss is −ln of its predicted probability. Confidently assigning a small probability to the true class produces a large penalty. Source: scikit-learn, `log_loss`: binary log loss and cross-entropy definition.
Comparison helps when both quantities address the same question but emphasize different properties. Report the definition, input data, threshold or averaging with the value. The source scikit-learn, `log_loss`: binary log loss and cross-entropy definition. supports the definition used here; other conventions can differ. Choose the measure to match the learning or analysis goal. Validity limit: For one-hot labels, only the true class contributes, so the loss is −ln of its predicted probability. Confidently assigning a small probability to the true class produces a large penalty. Source: scikit-learn, `log_loss`: binary log loss and cross-entropy definition.
Quanta exam set
Curated exam set for "Cross-entropy (classification loss)":
Question (front)
Which formula describes Cross-entropy (classification loss)?
Answer in your set
Question (front)
How do you rearrange Cross-entropy (classification loss) for Defining relation?
Answer in your set
Question (front)
Which common mistake happens with Cross-entropy (classification loss)?
Answer in your set
+ 7 more cards: units, variables, derivation, example, exam task
The formula set contains 10 cards. After importing, review them and start practicing; your ratings determine later review intervals.
This list names subject references and further reading. A page or section number appears when it is part of the reference; these are not verbatim quotations.
Create a curated FSRS exam set for H(p,q) = −Σ pᵢ ln(qᵢ): formula recall, variables, derivation, rearrangement, worked example, common mistakes and exam context.
Curated formula set · LaTeX · FSRS spaced repetition · import from Essential