Tensorflow Predicting values from custom estimator
I've created a custom estimator using the tutorial here, and trained it. It's saved a bunch of files in the model_dir that I passed to the estimator. I'm now trying to load the created model in another file to predict values.
What I tried was to copy/paste the same model function I used to train the model into a new file, then do
variable_predictor = tf.estimator.Estimator( model_fn=my_model_fn, model_dir="/tmp/modeltest1")
to load the model. Having done this I'm able to evaluate the model just fine, getting the same loss it reported when I evaluated it right after training. Giving it 82,283 entries (a numpy array that's 82283*10*25), I get a MSE of 5400ish for a batch size of 25.
When I try to predict with it I get nonsensical answers. I'm doing this:
predict_input_fn = tf.estimator.inputs.numpy_input_fn( x=test_independent_variables, num_epochs=1, shuffle=False) results = variable_predictor.predict(input_fn=predict_input_fn) resultlist= for result in results: resultlist.append(result)
What I get back does not make sense. I'm feeding in 82,283 entries and I'm getting out 643 predictions that are not nearly as close to the actual values as evaluation says the model is.
82283/643 = 128ish, while as in training my batch size was 25 - no relation there. What's causing it to not give back as many predictions as I ask it to make, and how can I fix this?