Added learn API

The API won't throw any errors on an empty learning set, so I don't see why there should be an *not empty* constraint.