The model is initially fit on a training dataset , The model ( e.g. a neural net or a naive Bayes classifier ) is trained on the training dataset using a supervised learning method , for example using optimization methods such as gradient descent or stochastic gradient descent .