We're making some improvements. Some features may be temporarily unavailable.
intermediate30 min

Supervised Learning

Classification and regression — train your first model with scikit-learn

Classification: Predicting Categories

Classification assigns data points to discrete categories. Common algorithms: Logistic Regression, Decision Trees, Random Forest, SVM.

Building a Classifier with scikit-learn

Output
Run your code to see output here

Precision, Recall, and F1-Score

MetricWhat It Measures
PrecisionOf all predicted positives, how many were actually positive?
RecallOf all actual positives, how many did we find?
F1-ScoreHarmonic mean of precision and recall — balances both
AccuracyOverall correct predictions / total predictions

Regression: Predicting Numbers

Regression predicts continuous values. Common algorithms: Linear Regression, Ridge, Lasso, Random Forest Regressor.

Output
Run your code to see output here

Overfitting vs Underfitting

  • Overfitting: Model memorizes training data but fails on new data (high variance)
  • Underfitting: Model is too simple to capture patterns (high bias)
  • The goal: Find the sweet spot — good generalization to unseen data

Check Your Understanding

If a model has 99% accuracy on training data but only 70% on test data, it's likely:

Exercise

Using the pattern above, train a LogisticRegression model on the same iris dataset and print the accuracy score.

Python will load on first run

Questions & Discussion

Sign in to ask a question or join the discussion.

Loading comments...