您的位置:首页 > 其它

neural-networks-and-deep-learning misleading_gradient_contours.py

2016-07-21 16:24 507 查看
其实是康托图,和之前的misleading_gradient没有什么太大的本质区别。

contour的level就是选择哪些值画线。

"""
misleading_gradient_contours
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Plots the contours of the function from misleading_gradient.py"""

#### Libraries
# Third party libraries
import matplotlib.pyplot as plt
import numpy

X = numpy.arange(-1, 1, 0.02)
Y = numpy.arange(-1, 1, 0.02)
X, Y = numpy.meshgrid(X, Y)
Z = X**2 + 10*Y**2

plt.figure()
CS = plt.contour(X, Y, Z, levels=[0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0])
plt.xlabel("$w_1$", fontsize=16)
plt.ylabel("$w_2$", fontsize=16)
plt.show()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: