machine-learning
Machine learning development patterns, model training, evaluation, and deployment. Use when building ML pipelines, training models, feature engineering, model evaluation, or deploying ML systems to production.
What this skill does
# Machine Learning Comprehensive machine learning skill covering the full ML lifecycle from experimentation to production deployment. ## When to Use This Skill - Building machine learning pipelines - Feature engineering and data preprocessing - Model training, evaluation, and selection - Hyperparameter tuning and optimization - Model deployment and serving - ML experiment tracking and versioning - Production ML monitoring and maintenance ## ML Development Lifecycle ### 1. Problem Definition **Classification Types:** - Binary classification (spam/not spam) - Multi-class classification (image categories) - Multi-label classification (document tags) - Regression (price prediction) - Clustering (customer segmentation) - Ranking (search results) - Anomaly detection (fraud detection) **Success Metrics by Problem Type:** | Problem Type | Primary Metrics | Secondary Metrics | |--------------|-----------------|-------------------| | Binary Classification | AUC-ROC, F1 | Precision, Recall, PR-AUC | | Multi-class | Macro F1, Accuracy | Per-class metrics | | Regression | RMSE, MAE | R², MAPE | | Ranking | NDCG, MAP | MRR | | Clustering | Silhouette, Calinski-Harabasz | Davies-Bouldin | ### 2. Data Preparation **Data Quality Checks:** - Missing value analysis and imputation strategies - Outlier detection and handling - Data type validation - Distribution analysis - Target leakage detection **Feature Engineering Patterns:** - Numerical: scaling, binning, log transforms, polynomial features - Categorical: one-hot, target encoding, frequency encoding, embeddings - Temporal: lag features, rolling statistics, cyclical encoding - Text: TF-IDF, word embeddings, transformer embeddings - Geospatial: distance features, clustering, grid encoding **Train/Test Split Strategies:** - Random split (standard) - Stratified split (imbalanced classes) - Time-based split (temporal data) - Group split (prevent data leakage) - K-fold cross-validation ### 3. Model Selection **Algorithm Selection Guide:** | Data Size | Problem | Recommended Models | |-----------|---------|-------------------| | Small (<10K) | Classification | Logistic Regression, SVM, Random Forest | | Small (<10K) | Regression | Linear Regression, Ridge, SVR | | Medium (10K-1M) | Classification | XGBoost, LightGBM, Neural Networks | | Medium (10K-1M) | Regression | XGBoost, LightGBM, Neural Networks | | Large (>1M) | Any | Deep Learning, Distributed training | | Tabular | Any | Gradient Boosting (XGBoost, LightGBM, CatBoost) | | Images | Classification | CNN, ResNet, EfficientNet, Vision Transformers | | Text | NLP | Transformers (BERT, RoBERTa, GPT) | | Sequential | Time Series | LSTM, Transformer, Prophet | ### 4. Model Training **Hyperparameter Tuning:** - Grid Search: exhaustive, good for small spaces - Random Search: efficient, good for large spaces - Bayesian Optimization: smart exploration (Optuna, Hyperopt) - Early stopping: prevent overfitting **Common Hyperparameters:** | Model | Key Parameters | |-------|---------------| | XGBoost | learning_rate, max_depth, n_estimators, subsample | | LightGBM | num_leaves, learning_rate, n_estimators, feature_fraction | | Random Forest | n_estimators, max_depth, min_samples_split | | Neural Networks | learning_rate, batch_size, layers, dropout | ### 5. Model Evaluation **Evaluation Best Practices:** - Always use held-out test set for final evaluation - Use cross-validation during development - Check for overfitting (train vs validation gap) - Evaluate on multiple metrics - Analyze errors qualitatively **Handling Imbalanced Data:** - Resampling: SMOTE, undersampling - Class weights: weighted loss functions - Threshold tuning: optimize decision threshold - Evaluation: use PR-AUC over ROC-AUC ### 6. Production Deployment **Model Serving Patterns:** - REST API (Flask, FastAPI, TF Serving) - Batch inference (scheduled jobs) - Streaming (real-time predictions) - Edge deployment (mobile, IoT) **Production Considerations:** - Latency requirements (p50, p95, p99) - Throughput (requests per second) - Model size and memory footprint - Fallback strategies - A/B testing framework ### 7. Monitoring & Maintenance **What to Monitor:** - Prediction latency - Input feature distributions (data drift) - Prediction distributions (concept drift) - Model performance metrics - Error rates and types **Retraining Triggers:** - Performance degradation below threshold - Significant data drift detected - Scheduled retraining (daily, weekly) - New training data available ## MLOps Best Practices ### Experiment Tracking Track for every experiment: - Code version (git commit) - Data version (hash or version ID) - Hyperparameters - Metrics (train, validation, test) - Model artifacts - Environment (packages, versions) ### Model Versioning ``` models/ ├── model_v1.0.0/ │ ├── model.pkl │ ├── metadata.json │ ├── requirements.txt │ └── metrics.json ├── model_v1.1.0/ └── model_v2.0.0/ ``` ### CI/CD for ML 1. **Continuous Integration:** - Data validation tests - Model training tests - Performance regression tests 2. **Continuous Deployment:** - Staging environment validation - Shadow mode testing - Gradual rollout (canary) - Automatic rollback ## Reference Files For detailed patterns and code examples, load reference files as needed: - **`references/preprocessing.md`** - Data preprocessing patterns and feature engineering techniques - **`references/model_patterns.md`** - Model architecture patterns and implementation examples - **`references/evaluation.md`** - Comprehensive evaluation strategies and metrics ## Integration with Other Skills - **performance** - For optimizing inference latency - **testing** - For ML-specific testing patterns - **database-optimization** - For feature store queries - **debugging** - For model debugging and error analysis
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.