Back to the study

Learning term

Loss function — Machine learning fundamentals

A loss function expresses the difference between a model prediction and its training target as a number. This card shows its role in “Machine learning fundamentals” and a safe diagnostic path.

Machine learning fundamentalsLevel 0–3

Orientation

A loss function expresses the difference between a model prediction and its training target as a number. At this level, separate purpose, input, and visible result. Place Loss function within Machine learning fundamentals before changing settings or files.

Exercise

Try it safely

After an update, a model returns different results for the same test input. For Loss function, first verify version, input shape or tokenization, and the reproducible seed; then compare one known test case against the previous model version. Open an isolated test environment and run “python -c "import torch; print(torch.__version__)"”. Write down the expected output first, do not alter production data, and record one safe next diagnostic step.

python -c "import torch; print(torch.__version__)"

Quick check

Can you explain the purpose, observable state, and most common failure source of Loss function — Machine learning fundamentals in one sentence each? Which evidence would you preserve before changing anything, and which repeated test would prove that the correction actually worked?