def parity(B=12, learning_rate=10e-5, epochs=200): X, Y = all_parity_pairs_with_sequence_labels(B) rnn = SimpleRNN(4) rnn.fit(X, Y, learning_rate=learning_rate, epochs=epochs, activation=T.nnet.sigmoid, show_fig=False)
def parity(B=12, learning_rate=10e-4, epochs=200): X, Y_t = all_parity_pairs_with_sequence_labels(B) rnn = SimpleRNN(20) rnn.fit(X, Y_t, learning_rate=learning_rate, epochs=epochs, activation=T.nnet.relu, show_fig=True)
def parity(B=12, learning_rate=1e-4, epochs=200): # B: number of bits X, Y = all_parity_pairs_with_sequence_labels(B) rnn = SimpleRNN(20) # size of hidden layer = 20 rnn.fit(X, Y, learning_rate=learning_rate, epochs=epochs, activation=T.nnet.relu, show_fig=True)
def parity(B=12, learning_rate=1., epochs=1000): X, Y = all_parity_pairs_with_sequence_labels(B) rnn = SimpleRNN(4) rnn.fit(X, Y, batch_sz=len(Y), learning_rate=learning_rate, epochs=epochs, activation=tf.nn.sigmoid, show_fig=False )
def parity(B=12, learning_rate=10e-4, epochs=1000): X, Y = all_parity_pairs_with_sequence_labels(B) rnn = SimpleRNN(4) rnn.fit(X, Y, batch_sz=10, learning_rate=learning_rate, epochs=epochs, activation=tf.nn.sigmoid, show_fig=False )
def parity(B=12, learning_rate=1e-4, epochs=200): X, Y = all_parity_pairs_with_sequence_labels(B) X = X.astype(np.float32) rnn = SimpleRNN(20) rnn.fit(X, Y, learning_rate=learning_rate, epochs=epochs, activation=tf.nn.relu, show_fig=False)
def parity(B=12, learning_rate=1., epochs=1000): # 很少看到learning rate 用 1 X, Y = all_parity_pairs_with_sequence_labels(B) print('X.shape:', X.shape) print('Y.shape:', Y.shape) rnn = SimpleRNN(20) rnn.fit( X, Y, batch_sz=len(Y), #????用full batch??? learning_rate=learning_rate, epochs=epochs, activation=tf.nn.sigmoid, show_fig=True)
>>>>>>> upstream/master break costs.append(cost) if show_fig: plt.plot(costs) plt.show() <<<<<<< HEAD def parity(B=12, learning_rate=10e-4, epochs=1000): ======= def parity(B=12, learning_rate=1., epochs=1000): >>>>>>> upstream/master X, Y = all_parity_pairs_with_sequence_labels(B) rnn = SimpleRNN(4) rnn.fit(X, Y, <<<<<<< HEAD batch_sz=10, ======= batch_sz=len(Y), >>>>>>> upstream/master learning_rate=learning_rate, epochs=epochs, activation=tf.nn.sigmoid, show_fig=False )
def parity(B=12, learning_rate=1e-4, epochs=200): X, Y = all_parity_pairs_with_sequence_labels(B) rnn = SimpleRNN(20) rnn.fit(X, Y, learning_rate=learning_rate, epochs=epochs, activation=T.nnet.relu, show_fig=False)
def parity(B=12, learning_rate=1., epochs=1000): X, Y = all_parity_pairs_with_sequence_labels(B) N, T, D = X.shape rnn = BasicRNN(X, 4) rnn.fit(X, Y, batch_size=100, epochs=1000)