4.2 Selecting an algorithm

When you’re doing classification, there isn’t just one way to do it! You have a whole menu of algorithms you could use, each of which have different technical and statistical approaches. Although they’re different, they’re all trying to do the same thing: predict whether your request will be granted or not.

For now we’ll stick with the one that FOIA Predictor uses: k-nearest neighbors. While the specifics of how it works don’t really matter, if you want to know how it works, you can read more here.

from sklearn.neighbors import KNeighborsClassifier

knn = KNeighborsClassifier(n_neighbors=20)