From supervised to reinforcement learning -- these memory tricks lock in every major ML algorithm, the bias-variance tradeoff, and the workflow that makes models actually work.
Or continue to the sub-topics below for more specialized Study Rooms and Forums
Proven Mnemonics & Acronyms — fast to learn, hard to forget.
from sklearn.model_selection import validation_curve
train_scores, val_scores = validation_curve(model, X, y, param_name='max_depth', param_range=range(1,20))
# Plot to see the bias-variance tradeoff visuallyfrom sklearn.model_selection import validation_curve
train_scores, val_scores = validation_curve(model, X, y, param_name='max_depth', param_range=range(1,20))
# Plot to see the bias-variance tradeoff visuallyfrom sklearn.model_selection import learning_curve
train_sizes, train_scores, val_scores = learning_curve(model, X, y, cv=5)
# Big gap between curves = overfitting. Both low = underfitting.from sklearn.model_selection import learning_curve
train_sizes, train_scores, val_scores = learning_curve(model, X, y, cv=5)
# Big gap between curves = overfitting. Both low = underfitting.from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier(n_estimators=100, random_state=42)
rf.fit(X_train, y_train)from xgboost import XGBClassifier
xgb = XGBClassifier(n_estimators=100, learning_rate=0.1)
xgb.fit(X_train, y_train)from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier(n_estimators=100, random_state=42)
rf.fit(X_train, y_train)from xgboost import XGBClassifier
xgb = XGBClassifier(n_estimators=100, learning_rate=0.1)
xgb.fit(X_train, y_train)from sklearn.linear_model import Lasso, Ridge, ElasticNet
lasso = Lasso(alpha=0.1) # L1 — kills features
ridge = Ridge(alpha=1.0) # L2 — shrinks features
enet = ElasticNet(alpha=0.1, l1_ratio=0.5) # bothfrom sklearn.linear_model import Lasso, Ridge, ElasticNet
lasso = Lasso(alpha=0.1) # L1 — kills features
ridge = Ridge(alpha=1.0) # L2 — shrinks features
enet = ElasticNet(alpha=0.1, l1_ratio=0.5) # both