Added a function for training GP hyperparameters.