Exercise 6: Machine learning 1

Implement a machine learning model in Python, including feature engineering, train–test splitting, model training, cross-validation, and evaluation.

https://github.com/justmarkham/scikit-learn-videos

NOTE: see Data Analytics with Python.pdf

Python

Implementation in Python with scikit-learn (20 min)

Walk through a simple, reproducible pipeline:

  1. Load dataset (toy dataset or small real-world example)
  2. Train–test split
  3. Preprocessing pipeline (e.g., StandardScaler + model)
  4. Fit logistic regression vs. one non-linear model (e.g., decision tree or SVM)
  5. Compare performance metrics
  6. Show how to inspect confusion matrix & classification report

Highlight: - Consistent API (fit, predict, score) - Use of Pipeline - Keeping code structured and reproducible

TipSession 6 survey

Before you wrap up, please complete the Session 6 survey here: ?meta:surveys.session_06.url. Thank you 🙏