Skip to main content
`Ctrl`+`K`

# Hyperparameter Optimization

In this project we revisit Detecting Forgery with k-NN and add hyperparameter optimization.

## Load Data Set

Task: Load the banknotes data set (cf. Detecting Forgery with k-NN). Drop the entropy column.

    # your solution

## Grid Search with Cross Validation

Task: Create a \(k\)-NN model with Scikit-Learn’s `KNeighborsClassifier`. Use hyperparameter optimization based on accuracy for choosing \(k\) and to find appropriate weights (uniform or inverse distance). Evaluate the model on a test set. Print optimal parameters and accuracy on the test set.

Solution:

    # your solution

## Decision Surface

Task: Train a second model based on variance and skewness only. Plot the decision surface (the surface separating the classes) with Matplotlib’s `contour` or `contourf`.

Solution:

    # your solution