description: simple lstm example tensorflow
compute sigmoid nonlinearity
1 | def sigmoid(x): |
convert output of sigmoid function to its derivative
1 | def sigmoid_output_to_derivative(output): |
training dataset generation
1 | int2binary = {} |
input variables
1 | alpha = 0.1 |
initialize neural network weights
1 | synapse_0 = 2 * np.random.random((input_dim, hidden_dim)) - 1 |
training logic # 训练的次数
1 | for j in range(10000): |
output
1 | Error:[3.45638663] |