Getting everything ready for you…

Loading courses, problems and your progress. This takes just a moment.

0s

Machine Learning (scikit-learn) Cheat Sheet

The scikit-learn pattern

model = SomeModel()
model.fit(X_train, y_train)
pred = model.predict(X_test)
model.score(X_test, y_test)

Pick a model

Number to predict → Linear Regression → Random Forest / Gradient Boosting
Category          → Logistic Regression → Random Forest / Gradient Boosting
Text              → TF-IDF + Naive Bayes or Logistic Regression
No labels         → K-means, PCA

Pick a metric

Regression: MAE, RMSE, R²
Balanced classes: accuracy
False alarms costly: precision
Misses costly: recall
Imbalanced: F1

Full Machine Learning (scikit-learn) documentation