3

I'm using tensorflow 0.8.0 and skflow (or now known as learn). My model is very similar to this example but with a dnn as the last layer (similar tot he minst example). Nothing very fancy going on, the model works pretty well on its own. The text inputs are a max of 200 characters and 3 classes.

The problem I'm seeing is when I try to load the model and make many predictions (Usually around 200 predictions or more), I start to see results vary.

For example, my model is already trained and I load it and go through my data and make predictions.

char_processor = skflow.preprocessing.ByteProcessor(200)
classifier = skflow.TensorFlowEstimator.restore('/path/to/model')

for item in dataset:
    # each item is an array of strings, ex: ['foo', 'bar', 'hello', 'world']
    line_data = np.array(list(char_processor.transform(item)))
    res = classifier.predict_proba(line_data)

If I load my classifier and only give it one item to predict upon then quit, it works perfectly. When I continue to make predictions, I start to see weirdness.

What could I be missing here? Shouldn't my model always return the same results for the same data?

AdamB
  • 3,101
  • 4
  • 34
  • 44
  • If your model uses the skflow implementation of batch normalisation that could be a source of the changes. The current implementation updates the moving averages during validation - see [this pull request](https://github.com/tensorflow/tensorflow/pull/2104). – user728291 May 23 '16 at 04:55
  • Hmm, I'm not doing any batch normalization. I still tried patching my tensorflow with that pull request and I still have the same issue, unless I need to retrain my model? – AdamB May 23 '16 at 05:20
  • If you are not using batch normalization then it is not the source of your problem and you can ignore my comment and link. Retraining would not be necessary. – user728291 May 23 '16 at 05:46
  • This issue looks similar to mine https://github.com/tensorflow/tensorflow/issues/2167 – AdamB May 23 '16 at 06:01
  • That issue does seem to be the case. When I remove the dnn this isn't doesn't seem to happen anymore. – AdamB May 23 '16 at 07:06

0 Answers0