optimization routines for hyperparameter tuning