基本ガイド
損失関数
A loss defines the objective used to assess predictions or another training target.
このガイドを聴くAIによるナレーション · ~3 min
概要
Individual loss values are often combined into a scalar for optimization, and the chosen objective is a proxy that may differ from the application's evaluation metric.
ディープダイブ
A prediction loss compares outputs with training targets according to a specified rule. Those targets can be labels or values constructed for the learning task; they should not automatically be called unquestionable truth. Implementations may produce per-example losses and then sum or average them for an optimization step. Choosing the rule matters. Mean squared error averages squared residuals, giving large residuals more influence than mean absolute error, which averages their absolute values. For residuals one and three, mean squared error is five, while mean absolute error is two. These are illustrative calculations rather than performance results from a dataset. Classification commonly uses cross-entropy. With a one-hot target and a predicted probability p for its class, the loss is minus log p. A lower probability for the target class gives a larger loss, so confident wrong predictions can incur high loss. The logarithm base determines the units: base-two loss is in bits, while a natural logarithm gives nats. For a target probability of one-quarter, minus log-base-two p is two bits. Gradient-based optimization needs usable derivative information, but differentiability requirements should not be generalized to every learning algorithm. Some losses have nondifferentiable points handled by an appropriate subgradient or surrogate. Accuracy is a discrete evaluation metric and is generally not directly useful as a gradient-training objective. A suitable training loss supplies an optimization signal; final task quality needs evaluation using the relevant metrics.
現実世界の実装
クロスエントロピー損失を使用して、確信のある誤分類にペナルティを与える電子メールスパム分類器をトレーニングする
少数の極端な邸宅がトレーニングを支配しないように、住宅価格の予測に平均絶対誤差を選択する
顔認識モデルが同じ人物の画像をまとめるようにコントラスト損失を適用する
チャットボットをより有益で誠実な応答に導くための報酬モデルの損失を設計する
損失関数の未来
Objective design can combine prediction terms, regularization, and other task requirements. Comparisons should state the target definition, formula, reduction, units, and evaluation metric. An objective can decrease while an application metric remains unchanged or worsens, so improvement should be measured rather than inferred from training loss alone. Custom losses need examination of the behavior they encourage as well as their numerical and optimization properties.
実践する
なぜそれが重要なのか
- より明確な判決. これは、明確な技術的主張とマーケティング言語を区別するのに役立ちます。
- 費用と予算. お金や時間を費やす前に、実装に関するより良い質問をすることができます。
- チームとワークフロー. 共通の理解を持ったチームは、製品、ポリシー、学習に関する意思決定をより適切に行うことができます。
気をつけてください
- チームが異なれば、同じ用語の使用方法も異なる可能性があるため、範囲を早めに定義してください。
- ベンチマークは好調に見えても、実際のパフォーマンスにはばらつきがある場合があります。
- データの品質と評価計画を無視すると、多くの場合、脆弱な結果が生じます。
次のステップ
- 必要な結果を平易な言葉で定義することから始めます。
- テストする前に、成功指標と失敗条件を 1 つ選択します。
- 洗練されたデモセットではなく、代表的なデータを使用して小規模なパイロットを実行します。
- 損失関数が役立つ場合と、より単純な方法の方が優れている場合を文書化します。
探検を続けましょう
よくある質問
What is Loss Functions?
A loss defines the objective used to assess predictions or another training target. Individual loss values are often combined into a scalar for optimization, and the chosen objective is a proxy that may differ from the application's evaluation metric.
For a prediction task, what does its selected loss quantify against the training target?
A loss defines a training objective; it does not automatically measure every aspect of application quality.
分類タスクに最も一般的に使用される損失関数はどれですか?
クロスエントロピーは、予測された確率分布を真のラベルと比較し、分類の標準的な選択肢です。
平均二乗誤差と比較して、平均絶対誤差を選択する理由は何ですか?
平均絶対誤差では、すべての誤差を二乗するのではなく比例的に扱うため、いくつかの極端な外れ値の影響は小さくなります。
Why does gradient-based training need a usable loss derivative or suitable substitute?
This concerns gradient-based training, not a claim that every possible learning algorithm requires a differentiable loss.
How does one-hot class cross-entropy change as probability assigned to the target class becomes very small?
The term minus log p grows as the target-class probability shrinks. This does not guarantee a particular gradient magnitude for every model weight.