Is there an implementation of pocket algorithm in Keras? As explained in Wikipedia, the pocket algorithm is a very simple variant/addition of/to ANN which keeps a copy of the best model seen so far and returns that one as the trained model (instead of the actual final state of the model). Implementing it is very simple and straightforward.

I was wondering if this algorithm is implemented in Keras.
Yes this is usually part of the early stopping algorithm, where you supply a cross-validation data set, and a limit on number of epochs since best result so far.

In Keras, you can use an instance of the EarlyStopping class, choosing the metric that you want the best model for, and setting the patience parameter to limit the number of epochs to test after any best so far result. The instance is supplied to the fit method as a callback.

See http://parneetk.github.io/blog/neural-networks-in-keras/ for an example (last section)