python - Save and restore Experimenter/Estimator in Tensorflow -


i'm writing program trains 4 neural networks , collects outcomes find better result. use ensemble method it, question not it.

the problem restoring each model after training process. found another question it, doesn't @ all.

(pseudo)-code

my english not good, try explain workflow using pseudo-python-code:

for in range(4):     # create estimator (a dnnclassifier).     estimator = build_estimator(...)     # train model.     estimator.fit(input_fn=...)  # other stuffs...  in range(4):     # restore estimator using same arguments.     estimator = build_estimator(...)     # predict input data.     predictions[i] = estimator.predict(input_fn=...)      # others stuffs using predictions collection. 

error

this is, in broad terms, code and, if looks , straightforward, doesn't work. error shown during restore part , means dnn wasn't saved properly.

2017-07-24 11:40:24.517773: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\framework\op_kernel.cc:1158] not found: key dnn/hiddenlayer_1/weights not found in checkpoint 2017-07-24 11:40:24.517884: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\framework\op_kernel.cc:1158] not found: key dnn/hiddenlayer_0/biases not found in checkpoint 2017-07-24 11:40:24.518739: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\framework\op_kernel.cc:1158] not found: key dnn/hiddenlayer_0/weights not found in checkpoint 2017-07-24 11:40:24.519621: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\framework\op_kernel.cc:1158] not found: key dnn/logits/biases not found in checkpoint 2017-07-24 11:40:24.519684: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\framework\op_kernel.cc:1158] not found: key dnn/hiddenlayer_1/biases not found in checkpoint 2017-07-24 11:40:24.519861: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\framework\op_kernel.cc:1158] not found: key dnn/hiddenlayer_2/weights not found in checkpoint 2017-07-24 11:40:24.519947: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\framework\op_kernel.cc:1158] not found: key dnn/hiddenlayer_2/biases not found in checkpoint 2017-07-24 11:40:24.522592: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\framework\op_kernel.cc:1158] not found: key dnn/logits/weights not found in checkpoint 

note

  1. the dnnclassifier has been created , restored using same arguments.
  2. as far know don't need save checkpoints because dnnclassifier during training process.
  3. i read somewhere before use predict evaluation required. tried, nothing changed.
  4. i can share other fragment of code if want, don't think can more.

you should create model this:

estimator = tf.contrib.learn.dnnclassifier( feature_columns=feature_cols, hidden_units=[10,10,10], n_classes=2 , model_dir= your_path)

estimator.fit(input_fn=lambda: input_fn1(training data), steps=1000)

estimator_predict = estimator.predict(input_fn=lambda: input_fn1(test_data))


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -