ml:loss_functions
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| ml:loss_functions [2023/10/25 21:36] – [Loss Functions] jmflanig | ml:loss_functions [2024/07/23 00:32] (current) – jmflanig | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Loss Functions ====== | ====== Loss Functions ====== | ||
| + | A function that is minimized during training (using gradient descent or Adam, for example) is called a loss function. | ||
| + | ==== Code Examples ===== | ||
| + | * Hugging Face | ||
| + | * Custom loss in Hugging Face trainer: [[https:// | ||
| + | |||
| + | |||
| + | ==== List of Loss Functions ==== | ||
| * Cross-entropy (aka log loss, conditional log-likelihood, | * Cross-entropy (aka log loss, conditional log-likelihood, | ||
| * Lots of different ways to write this loss function. | * Lots of different ways to write this loss function. | ||
| * The cross-entropy version writes it as $L(\mathcal{D}) = -\sum_{i=1}^{N}\sum_{y} p(y|x_i) log(p_\theta(y|x_i))$, | * The cross-entropy version writes it as $L(\mathcal{D}) = -\sum_{i=1}^{N}\sum_{y} p(y|x_i) log(p_\theta(y|x_i))$, | ||
| + | * Cross-entropy loss can be written as | ||
| + | \[ | ||
| + | L(\theta, | ||
| + | \] | ||
| + | * This is often call the Conditional Random Field (CRF) loss | ||
| * The minimum of cross-entropy loss does not always exist, and does not exist if the data training data can be completely separated. | * The minimum of cross-entropy loss does not always exist, and does not exist if the data training data can be completely separated. | ||
| * Perceptron loss \[ | * Perceptron loss \[ | ||
| Line 14: | Line 26: | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| - | | + | |
| + | L(\theta, | ||
| + | \] | ||
| + | * Risk\[ | ||
| L(\theta, | L(\theta, | ||
| \] | \] | ||
| + | \[ | ||
| + | L(\theta, | ||
| + | \] | ||
| + | * Ramp loss | ||
| * Soft ramp loss | * Soft ramp loss | ||
| * Infinite ramp loss | * Infinite ramp loss | ||
ml/loss_functions.1698269781.txt.gz · Last modified: 2023/10/25 21:36 by jmflanig