← Lesson
BitWithBite
AI & Machine Learning · Quick Reference

lesson-1.1 Cheat Sheet

AI & Machine Learning
In one line: Scikit-learn's entire API is built around three object types that all share a consistent interface. Once you internalize this shape, the whole library — hundreds of algorithms —...

Key Ideas

1Estimators. Anything that learns from data. Every estimator has a .fit(X, y) method (or .fit(X) for unsupervised algorithms). Calling fit is what triggers learning — it computes a...
2Transformers. A subtype of estimator that modifies data rather than predicting a label. They implement .fit(X) to learn parameters (like mean/std for scaling) and .transform(X) to a...
3Predictors. Estimators that implement .predict(X) — and often .predict_proba(X) or .decision_function(X) — to produce outputs on new data once fitted.
4Why this rigid shape matters. Because it lets scikit-learn treat wildly different algorithms — a scaler, a PCA, a random forest — as interchangeable building blocks. That uniformity is what makes P...

Code Examples

from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression scaler = StandardScaler() scaler.fit(X_train) # learns mean_, scale_ X_train_scaled = scaler.transform(X_train) clf = LogisticRegress...