Last active
July 3, 2019 01:39
-
-
Save xunge/5d300183dae396e8f987e27ac2a28c3d to your computer and use it in GitHub Desktop.
线性回归的训练过程
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with tf.Session() as sess: | |
sess.run(tf.global_variables_initializer()) | |
for i in range(1000): | |
for j in range(4): | |
sess.run(train, feed_dict={x: np.expand_dims(X[j], 0), y: np.expand_dims(Y[j], 0)}) | |
loss_ = sess.run(loss, feed_dict={x: X, y: Y}) | |
print("step: %d, loss: %.3f" % (i, loss_)) | |
print("X: %r" % X) | |
print("pred: %r" % sess.run(out, feed_dict={x: X})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment