Created
June 7, 2017 08:55
-
-
Save murayama333/4d15390d27151a95fa7da87a3b25510b 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
import tensorflow as tf | |
import numpy as np | |
features = [tf.contrib.layers.real_valued_column("x", dimension=1)] | |
estimator = tf.contrib.learn.LinearRegressor(feature_columns=features) | |
x = np.array([1., 2., 3., 4.]) | |
y = np.array([0., -1., -2., -3.]) | |
input_fn = tf.contrib.learn.io.numpy_input_fn({"x": x}, y, batch_size=4, num_epochs=1000) | |
estimator.fit(input_fn=input_fn, steps=1000) | |
print(estimator.evaluate(input_fn=input_fn)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment