adding function to tune and obtain the optimal hyperparameter values