Generally, you only need your Keras model to return prediction values, but there are situations where you want your predictions to retain a portion of the input. A common example is forwarding unique ‘instance keys’ while performing batch predictions. In this blog and corresponding notebook code, I’ll demonstrate how to modify the signature of a trained Keras model to forward features to the output or pass through instance keys.

How to forward instance keys to the output

Sometimes you’ll have a unique instance key that is associated with each row and you want that key to be output along with the prediction so you know which row the prediction belongs to. You’ll need to add keys when executing distributed batch predictions with a service like Cloud AI Platform batch prediction. Also, if you’re performing continuous evaluation on your model and you’d like to log metadata about predictions for later analysis. Lak Lakshmanan, shows how to do this with TensorFlow estimators, but what about Keras?

#keras #tensorflow #google-cloud-platform #machine-learning

How to Extend a Keras Model
7.25 GEEK