Description
Return one focal-loss term for a true class.
Training losses compare predicted probabilities with target mass, and temperature rescales logits before a probability transformation. Label smoothing and focal weighting alter particular loss terms; evaluating one term or transformation does not train a model, select its hyperparameters or establish calibrated confidence.
Return one focal-loss term for a true class.
When to use this tool
Use Focal Loss One Probability Term when evaluating the stated loss contribution, smoothed target or temperature transformation.
How to use the tool and how it works
- Enter trueClassProbability, alpha, gamma. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read loss. Use the output convention below.
Return one focal-loss term for a true class. Require probability in (0,1] and alpha/gamma >= 0; loss = -alpha*(1-p)^gamma*ln(p), explicitly zero when alpha zero.1
Focal weighting reduces the relative contribution of well-classified examples; this calculation evaluates one supplied probability term.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| trueClassProbability | True Class Probability | Required. Finite number; minimum 0; maximum 1; strictly above 0. |
| alpha | Alpha | Required. Finite number; minimum 0. |
| gamma | Gamma | Required. Finite number; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| loss | Loss | Required. Finite number. |
{
"input": {
"trueClassProbability": 0.5,
"alpha": 0.25,
"gamma": 2
},
"output": {
"loss": 0.04332169878499658
}
} Limitations and assumptions
- No full dataset loss, class weighting recommendation or training result is produced.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Sum the appropriate contributions for a complete loss, and use a validated training/calibration procedure and held-out evaluation to select hyperparameters and assess predictions.
References
-
Calculation and input contract: classification/focal-loss-one-probability-term — tool.io
-
Focal Loss for Dense Object Detection — Tsung-Yi Lin and coauthors
Similar or alternative tools
- Multiclass Cross Entropy Smoothing Term
Return one label-smoothed cross-entropy class term.
- Binary Logit Temperature Slope
Return temperature-scaled logistic probability and its logit derivative.