first version of Bengio's patience