Question

Question 1: The K nearest neighbor algorithm has hyper- parameters in addition to K. Use the titanic dataset to simultaneously tune the values of more than one hyper-parameter. E.g. Value of K, weight, and metric. You can either do nested for loops for this or use the grid search OR random search function from Scikit-learn. (Please submit code inside of a Jupyter notebook). Based on your analysis, propose a strategy for selecting an optimal value of k for a given dataset and discuss its advantages and limitations. 10 points Describe and analyze the impact of varying the value of k in the KNN classifier on its classification performance considering both accuracy metrics. 5 points

Fig: 1