# Loss functions: cross-entropy and mean squared error

Source: https://onco.cc/terms/cross-entropy-mse/  
OnCo record `cross-entropy-mse` (Term). Data CC BY-NC 4.0, attribute "Data from OnCo (onco.cc)"; commercial use needs a licence.

## TL;DR

A loss function is the number training tries to make small: cross-entropy for classification (how surprised the model was by the true class) and mean squared error for regression and reconstruction (how far off the predicted values were).

## Summary

Cross-entropy between two distributions measures the average number of bits needed to encode events from one using a code optimised for the other (Wikipedia); as a loss it penalises confident wrong class probabilities. Mean squared error is the average squared difference between estimates and true values (Wikipedia), the objective for predicting expression, drug sensitivity or reconstructing masked genes. Survival models use the Cox partial likelihood instead, which is why they are not interchangeable with regressors.

## Fields

- Kind: Term
- Last checked: 2026-09-24
- Also known as: cross-entropy; cross-entropy loss; mean squared error; MSE loss; reconstruction loss; loss function; training objective
- Tags: cansim-terms

## Notes

- Listed in the CanSim terms map 1.0.0 (docs/onco/terms.json, generated 2026-09-24), CC BY 4.0, attribution: CanSim project, an open, public-data-first cancer foundation-model programme; CanSim page path /terms/losses.

## Sources

- Wikipedia: https://en.wikipedia.org/wiki/Cross-entropy
- Wikipedia: mean squared error: https://en.wikipedia.org/wiki/Mean_squared_error
- Wikipedia: https://en.wikipedia.org/wiki/Cross-entropy

## Connected records

- terms: [Cancer AI vocabulary (CanSim terms map)](https://onco.cc/terms/cancer-ai-vocabulary/), [Masked autoencoders and masked gene modelling](https://onco.cc/terms/masked-modelling/), [Ridge regression and the multilayer perceptron](https://onco.cc/terms/ridge-regression/), [Univariate Cox scores and time-dependent metrics](https://onco.cc/terms/time-dependent-auc/)

---
JSON: https://onco.cc/api/v1/entities/cross-entropy-mse.json