我正在使用 Colab 创建一个笔记本,用于训练机器接收字符串并以手写风格输出。我使用这个Jupyter 笔记本作为如何实现此类内容的指南,因为这是我使用机器学习所做的第一件事。
我已将笔记本中的 TensorFlow 降级到 1.15.2,以避免不同版本支持不同属性的问题 - 主要是因为我引用的上述笔记本是使用 TensorFlow 版本 1.X 创建的。我正在创建的笔记本使用 Python 3。
在下面的代码中,我试图绘制中风概率的高斯图。
def gauss_plot(strokes, title, figsize=(20,2)):
plt.figure(figsize=figsize)
buff = 1
epsilon = 1e-4
minx= np.min(strokes[:,0])-buff
maxx = np.max(strokes[:,0])+buff
miny = np.min(strokes[:,1])-buff
maxy = np.max(strokes[:,1])+buff
delta = abs(maxx-minx)/400. ;
x = np.arange(minx, maxx, delta)
y = np.arange(miny, maxy, delta)
X, Y = np.meshgrid(x, y)
Z = np.zeros_like(X)
for i in range(strokes.shape[0]):
gauss = mlab.bivariate_normal(X, Y, sigmax=strokes[i,2], sigmay=strokes[i,3], mux=strokes[i,0], muy=strokes[i,1], sigmaxy=0.0)
# gauss = mlab.np.compat.v1.biv_normal(X, …Run Code Online (Sandbox Code Playgroud)