Expert guidelines for scikit-learn development, focusing on machine learning workflows, model development, evaluation, and best practices.
train_test_split() with random_state for reproducibilitystratify=yStandardScaler for normally distributed featuresMinMaxScaler for bounded featuresRobustScaler for data with outliersOneHotEncoder, OrdinalEncoder, LabelEncoderSimpleImputer, KNNImputerPipeline to chain preprocessing and modelingfrom sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier
pipeline = Pipeline([
('scaler', StandardScaler()),
('classifier', RandomForestClassifier(random_state=42))
])
ColumnTransformer for different preprocessing per feature typecross_val_score() for quick evaluationcross_validate() for multiple metricsKFold for regressionStratifiedKFold for classificationTimeSeriesSplit for temporal dataGroupKFold for grouped dataGridSearchCV for exhaustive searchRandomizedSearchCV for large parameter spacesn_jobs=-1 for parallel processingaccuracy_score for balanced classesprecision_score, recall_score, f1_score for imbalancedroc_auc_score for ranking abilityclassification_report() for comprehensive overviewconfusion_matrix() for error analysismean_squared_error (MSE) for general usemean_absolute_error (MAE) for interpretabilityr2_score for explained varianceclass_weight='balanced'SelectKBest with statistical testsRFE (Recursive Feature Elimination)SelectFromModeljoblib for saving and loading modelsn_jobs=-1 for parallel processing where availablewarm_start=True for iterative trainingpartial_fit() for large datafrom sklearn.ensemble import RandomForestClassifierrandom_state for reproducibilityCreate or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).