小编zer*_*vty的帖子

是否可以使用matplotlib在单独的窗口中显示多个图?

您好我正在绘制一个函数10次并打印单独的值.我还想在单独的窗口中分别绘制所有10个案例.

所以我创建了一个新for loop的绘图,它仍然只绘制第一个实例,一旦我关闭第一个实例,只有那时我才能看到第二个实例.

我也试过用plt.hold(true).

这是我试图做的 -

def signal():
    t1 = np.random.choice(candidates)
    t2 = np.random.choice(candidates)
    t3 = np.random.choice(candidates)
    t4 = np.random.choice(candidates)
    t5 = np.random.choice(candidates)
    y = a * np.exp(-t /t1) + a * np.exp(-t /t2) + a * np.exp(-t /t3) + a * np.exp(-t /t4) + a * np.exp(-t /t5)
return y

for i in range(nsets):
    signalset = []
    signalset.append(signal())
    print(signal())

for i in range (nsets):
    plt.plot(t, signal())
    plt.show()
    plt.hold(True)
Run Code Online (Sandbox Code Playgroud)

有什么办法可以在10个不同的窗口同时生成10个图吗?

python matplotlib

9
推荐指数
1
解决办法
1万
查看次数

张量流中的MNIST分类,RecursionError:超出最大递归深度

我为MNIST分类运行了一个神经网络模型并收到了错误 -

RecursionError: maximum recursion depth exceeded
Run Code Online (Sandbox Code Playgroud)

我检查了stackoverflow上的一些问题,并试图将递归限制增加到1500但是没有用.我该如何增加限额?我怎么知道什么限制会导致堆栈溢出?

我从这里开始学习

我的Windows 10机器上有Anaconda 3.5发行版.

完整的代码在这里 -

import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data

mnist= input_data.read_data_sets("/tmp/data/", one_hot=True)

n_nodes_hl1 = 500
n_nodes_hl2 = 500
n_nodes_hl3 =500

n_classes = 10
batch_size = 100

#height x weight
x = tf.placeholder('float', [None, 784])
y = tf.placeholder('float')

def neural_network_model(data):

    hidden_1_layer= {'weights': tf.Variable(tf.random_normal([784, n_nodes_hl1])),
                 'biases': tf.Variable(tf.random_normal([n_nodes_hl1]))
                 }
    hidden_2_layer = {'weights': tf.Variable(tf.random_normal([n_nodes_hl1, n_nodes_hl2])),
                  'biases': tf.Variable(tf.random_normal([n_nodes_hl2]))
                  }
    hidden_3_layer = {'weights': tf.Variable(tf.random_normal([n_nodes_hl1, n_nodes_hl2])),
                  'biases': tf.Variable(tf.random_normal([n_nodes_hl3]))
                  }
    output_layer = {'weights': tf.Variable(tf.random_normal([n_nodes_hl3,n_classes])), …
Run Code Online (Sandbox Code Playgroud)

python neural-network python-3.x deep-learning tensorflow

1
推荐指数
1
解决办法
686
查看次数