Data & Computing機械学習University
AQAAPOntarioNSWCBSEGCE O-LevelMoECAPS

二値クロスエントロピー損失 Calculator

分類のための損失関数。

Use the free calculatorCheck the variablesOpen the advanced solver
This is the free calculator preview. Advanced walkthroughs stay in the app.
Result
Ready
Loss

Formula first

Overview

バイナリクロスエントロピー損失(ログ損失)は、2つの確率分布(実際の二値ラベルと予測確率)の差を定量化します。確信はあるが誤った予測に対して対数的に大きなペナルティを適用し、勾配降下法などの最適化アルゴリズムを導いてモデルの精度を向上させます。

Symbols

Variables

y = True Label (0/1), p = Predicted Prob, L = Loss

True Label (0/1)
Variable
Predicted Prob
Variable
Loss
Variable

Apply it well

When To Use

When to use: この関数は、出力が0から1の間の単一確率値である二値分類タスクのために特別に設計されています。ロジスティック回帰や、出力層にシグモイド活性化関数を利用するニューラルネットワークの目的関数として最も一般的に使用されます。

Why it matters: 単純な分類誤差とは異なり、この損失関数は微分可能であり、深層学習における誤差逆伝播に不可欠です。モデルが「不確かに間違っている」場合よりも「確信を持って間違っている」場合により厳しくペナルティを課すことで、よりロバストな確率的予測を実現します。

Avoid these traps

Common Mistakes

  • 底 10 の対数を使うこと(自然対数を使用します)。
  • p=0 または p=1 ちょうどにすること(無限大を引き起こします)。

One free problem

Practice Problem

医療診断モデルが、患者が特定の疾患を持つ確率を0.85と予測しています。患者が実際にその疾患を持っている場合(y=1)、バイナリクロスエントロピー損失を計算してください。

Hint: y=1なので、式は L = -ln(p) に簡略化されます。

The full worked solution stays in the interactive walkthrough.

References

Sources

  1. Wikipedia: Cross-entropy
  2. Deep Learning by Ian Goodfellow, Yoshua Bengio, and Aaron Courville
  3. Deep Learning (Goodfellow, Bengio, Courville)
  4. Pattern Recognition and Machine Learning (Bishop)
  5. Goodfellow, Bengio, and Courville Deep Learning
  6. Bishop Pattern Recognition and Machine Learning
  7. Standard curriculum — Machine Learning