Block 72: Classification: KNN & Logistic Regression
Train and evaluate two classification algorithms.
Concepts
- KNeighborsClassifier with n_neighbors
- LogisticRegression with max_iter
- predict() vs predict_proba()
- Comparing accuracy of two models
Code Examples
See exercise below.
Exercise
Compare KNN and Logistic Regression on the Iris dataset. Which is more accurate? Try k=1, 5, 15 for KNN. Plot accuracy vs k.
Homework
What is the bias-variance trade-off? How does k in KNN relate to it? Tuesday