[Intro to Deep Learning with PyTorch -- L2 -- N20] Cross-Entropy

Posted answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Intro to Deep Learning with PyTorch -- L2 -- N20] Cross-Entropy相关的知识,希望对你有一定的参考价值。

If I have bunch of events and a bunch of probabilities, how likely is it those events happen based on the probabilities?

If it is very likely then we have a small cross entropy; 

If it is unlikely, then we have a large cross entropy.

技术图片

 

 

import numpy as np

# Write a function that takes as input two lists Y, P,
# and returns the float corresponding to their cross-entropy.
def cross_entropy(Y, P):
    Y = np.float_(Y)
    P = np.float_(P)
    return -np.sum(Y * np.log(P) + (1 - Y) * np.log(1 - P))

 

以上是关于[Intro to Deep Learning with PyTorch -- L2 -- N20] Cross-Entropy的主要内容,如果未能解决你的问题,请参考以下文章

[Intro to Deep Learning with PyTorch -- L2 -- N15] Softmax function

[Intro to Deep Learning with PyTorch -- L2 -- N20] Cross-Entropy

[Intro to Deep Learning with PyTorch -- L2 -- N14] Sigmoid function

Intro to Machine Learning

How To Improve Deep Learning Performance

deep learning入门:感知机