2

I have updated my tensorflow from 0.7 to 0.9 on python3.And now i can't restore my previous saved models with skflow(tensorflow.contrib.learn).Here is the sample code example that was worked on tensorflow 0.7.

import tensorflow.contrib.learn as skflow
from sklearn import datasets, metrics, preprocessing

boston = datasets.load_boston()
X = preprocessing.StandardScaler().fit_transform(boston.data)
regressor = skflow.TensorFlowLinearRegressor()
regressor.fit(X, boston.target)
score = metrics.mean_squared_error(regressor.predict(X), boston.target)
print ("MSE: %f" % score)

regressor.save('/home/model/')

classifier = skflow.TensorFlowEstimator.restore('/home/model/')

On tensorflow 0.9 I have recieved this errors.

AttributeError: 'TensorFlowLinearRegressor' object has no attribute '_restore'

1 Answers1

0

I belive save and restore have been deprecated in favor of the model_dir param when building the estimator/regressor :

regressor = skflow.TensorFlowLinearRegressor(model_dir='/home/model/')
regressor.fit(X, boston.target)
...
estimator = skflow.TensorFlowLinearRegressor(model_dir='/home/model/')
estimator.predict(...)
almathie
  • 731
  • 5
  • 22
  • just to clarify, if I train/fit model in xyz.py and use predict code in mno.py (without training model again); will it work ? – turtle Oct 12 '16 at 17:22