import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig=plt.figure()
ax=Axes3D(fig)
X=np.linspace(0.01,0.99,101)
Y=np.linspace(0.01,0.99,101)
X,Y=np.meshgrid(X,Y)
Z=-(X*np.log2(Y)+(1-X)*np.log2(1-Y))
ax.plot_surface(X,Y,Z,rstride=1,cstride=1,cmap='rainbow')
plt.show()

可看出当两个分布一致时,熵取值最小

交叉熵

相关文章:

  • 2021-09-06
  • 2021-08-31
猜你喜欢
  • 2021-06-24
相关资源
相似解决方案