aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/examples/tutorials/estimators/abalone.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/examples/tutorials/estimators/abalone.py')
-rw-r--r--tensorflow/examples/tutorials/estimators/abalone.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/tensorflow/examples/tutorials/estimators/abalone.py b/tensorflow/examples/tutorials/estimators/abalone.py
index 932ce8a8b2..3c0ea2e409 100644
--- a/tensorflow/examples/tutorials/estimators/abalone.py
+++ b/tensorflow/examples/tutorials/estimators/abalone.py
@@ -134,12 +134,22 @@ def main(unused_argv):
# Instantiate Estimator
nn = tf.contrib.learn.Estimator(model_fn=model_fn, params=model_params)
-
+
+ def get_train_inputs():
+ x = tf.constant(training_set.data)
+ y = tf.constant(training_set.target)
+ return x, y
+
# Fit
- nn.fit(x=training_set.data, y=training_set.target, steps=5000)
+ nn.fit(input_fn=get_train_inputs, steps=5000)
# Score accuracy
- ev = nn.evaluate(x=test_set.data, y=test_set.target, steps=1)
+ def get_test_inputs():
+ x = tf.constant(test_set.data)
+ y = tf.constant(test_set.target)
+ return x, y
+
+ ev = nn.evaluate(input_fn=get_test_inputs, steps=1)
print("Loss: %s" % ev["loss"])
print("Root Mean Squared Error: %s" % ev["rmse"])