Problem 4 done, but used grid search method. Need to improve