Skip to main content
added 20 characters in body; edited title
Source Link
nbro
  • 41.4k
  • 12
  • 114
  • 205

Why is the cross-entropy a cost function?

The question looks foolish, but I think cross-entropy is somewhat weird as a cost function.

What I mean is, for example mean square error asAs a cost function for linear regression, itthe mean square error $ \sum_{i=1}^{n} (y_i - (ax_i+b)) ^2$ seems quite rational. Becausereasonable, because it literally/directly measures the error between real value and predicted value, directly.

For mathematic expression : $ \sum_{i=1}^{n} (y_i - (ax_i+b)) ^2$

But aboutHowever, in the case of the cross-entropy, I do not understand what it is.

For multi-class classification, for example, with 3 classes:

, the true target =[ 0 0 1 ]

is $[ 0, 0, 1 ]$, while the output of the model = [ 0.2 0.3 0.5 ]is $[ 0.2, 0.3, 0.5 ]$ (maybe with a softmax activation at the last layer)

 . So, the error of it is  : $C(x) = -(0*log(0.2) + 0*log(0.3) + 1*log(0.5))$.

It looks... I don't know, why it is a "Errorit an "error?" and howHow can it make updatebe updated with backpropagation?

Also, what is the objective of it? Maybe optimization, so maybe minimizing error? thenThen what happens?

Why is cross-entropy a cost function?

The question looks foolish, but I think cross-entropy is somewhat weird as a cost function.

What I mean is, for example mean square error as a cost function for linear regression, it seems quite rational. Because it literally measures error between real value and predicted value, directly.

For mathematic expression : $ \sum_{i=1}^{n} (y_i - (ax_i+b)) ^2$

But about cross-entropy, I do not understand what it is.

For multi-class classification, for example, with 3 classes:

true target =[ 0 0 1 ]

output of model = [ 0.2 0.3 0.5 ] (maybe with softmax activation at last layer)

  So the error of it is  : $C(x) = -(0*log(0.2) + 0*log(0.3) + 1*log(0.5))$

It looks... I don't know, why it is a "Error?" and how can it make update with backpropagation?

Also, what is the objective of it? Maybe optimization, so maybe minimizing error? then what happens?

Why is the cross-entropy a cost function?

The question looks foolish, but I think cross-entropy is somewhat weird as a cost function.

As a cost function for linear regression, the mean square error $ \sum_{i=1}^{n} (y_i - (ax_i+b)) ^2$ seems quite reasonable, because it literally/directly measures the error between real value and predicted value.

However, in the case of the cross-entropy, I do not understand what it is.

For multi-class classification, for example, with 3 classes, the true target is $[ 0, 0, 1 ]$, while the output of the model is $[ 0.2, 0.3, 0.5 ]$ (maybe with a softmax activation at the last layer). So, the error of it is: $C(x) = -(0*log(0.2) + 0*log(0.3) + 1*log(0.5))$.

It looks... I don't know, why is it an "error?" How can it be updated with backpropagation?

Also, what is the objective of it? Maybe optimization, so maybe minimizing error? Then what happens?

Source Link
JAEMTO
  • 125
  • 4

Why is cross-entropy a cost function?

The question looks foolish, but I think cross-entropy is somewhat weird as a cost function.

What I mean is, for example mean square error as a cost function for linear regression, it seems quite rational. Because it literally measures error between real value and predicted value, directly.

For mathematic expression : $ \sum_{i=1}^{n} (y_i - (ax_i+b)) ^2$

But about cross-entropy, I do not understand what it is.

For multi-class classification, for example, with 3 classes:

true target =[ 0 0 1 ]

output of model = [ 0.2 0.3 0.5 ] (maybe with softmax activation at last layer)

So the error of it is : $C(x) = -(0*log(0.2) + 0*log(0.3) + 1*log(0.5))$

It looks... I don't know, why it is a "Error?" and how can it make update with backpropagation?

Also, what is the objective of it? Maybe optimization, so maybe minimizing error? then what happens?