ml-best-practices
Model selection guidelines, feature engineering techniques, hyperparameter tuning strategies, evaluation metrics, and common ML frameworks
What this skill does
# ML Best Practices ## Model Selection Guidelines ### Problem Type Classification - **Supervised Learning**: Labeled data for training - Regression: Predict continuous values (Linear Regression, Random Forest, Gradient Boosting) - Classification: Predict discrete labels (Logistic Regression, SVM, Decision Trees, Neural Networks) - **Unsupervised Learning**: Unlabeled data exploration - Clustering: Group similar data points (K-Means, DBSCAN, Hierarchical) - Dimensionality Reduction: Reduce feature space (PCA, t-SNE, UMAP) - Anomaly Detection: Identify outliers (Isolation Forest, One-Class SVM) - **Reinforcement Learning**: Learn through interaction with environment - Policy-based: Learn policy directly (REINFORCE, PPO) - Value-based: Learn value function (DQN, SARSA) ### Algorithm Selection Criteria - **Data Size**: Small vs. large datasets - **Feature Types**: Numerical, categorical, text, image - **Interpretability**: Need for model explanations - **Training Time**: Constraints on model training - **Inference Latency**: Real-time vs. batch predictions - **Accuracy Requirements**: Trade-offs with complexity ### Common ML Frameworks - **scikit-learn**: Traditional ML algorithms, easy to use - **TensorFlow/Keras**: Deep learning, production-ready - **PyTorch**: Research-friendly, dynamic computation graphs - **XGBoost/LightGBM**: Gradient boosting for tabular data - **Hugging Face Transformers**: Pre-trained NLP models ## Feature Engineering Techniques ### Numerical Features - **Scaling**: Standardization (z-score) or Min-Max scaling - **Binning**: Convert continuous to categorical - **Polynomial Features**: Create interaction terms - **Log Transformations**: Handle skewed distributions - **Normalization**: Scale to unit norm ### Categorical Features - **One-Hot Encoding**: Binary columns for each category - **Label Encoding**: Map categories to integers - **Ordinal Encoding**: Preserve order for ordinal categories - **Target Encoding**: Replace with target mean (with regularization) - **Embedding**: Learn dense representations (for high cardinality) ### Text Features - **Bag of Words**: Word frequency counts - **TF-IDF**: Term frequency-inverse document frequency - **N-grams**: Capture word sequences - **Word Embeddings**: Pre-trained (Word2Vec, GloVe) or learned - **Transformer Embeddings**: Contextual embeddings (BERT, RoBERTa) ### Feature Selection - **Filter Methods**: Statistical tests, correlation analysis - **Wrapper Methods**: Recursive feature elimination, forward/backward selection - **Embedded Methods**: L1 regularization, tree-based feature importance - **Dimensionality Reduction**: PCA, LDA, autoencoders ## Hyperparameter Tuning Strategies ### Search Strategies - **Grid Search**: Exhaustive search over parameter grid - **Random Search**: Random sampling from parameter space - **Bayesian Optimization**: Use probabilistic model to guide search - **Evolutionary Algorithms**: Genetic algorithms for parameter evolution - **Successive Halving**: Early stopping for poor configurations ### Common Hyperparameters - **Tree-based Models**: max_depth, n_estimators, learning_rate, min_samples_split - **Neural Networks**: learning_rate, batch_size, number of layers, number of units - **SVM**: C, kernel, gamma - **K-Means**: n_clusters, init, n_init ### Tuning Best Practices - **Cross-Validation**: Use k-fold or stratified k-fold for robust evaluation - **Early Stopping**: Stop training when validation performance degrades - **Learning Rate Schedules**: Decay learning rate over time - **Ensembling**: Combine multiple models for better performance ## Evaluation Metrics and Validation Methods ### Regression Metrics - **Mean Squared Error (MSE)**: Average of squared errors - **Root Mean Squared Error (RMSE)**: Square root of MSE - **Mean Absolute Error (MAE)**: Average of absolute errors - **R-squared**: Proportion of variance explained - **Mean Absolute Percentage Error (MAPE)**: Percentage-based error ### Classification Metrics - **Accuracy**: Overall correct predictions - **Precision**: True positives / (true positives + false positives) - **Recall**: True positives / (true positives + false negatives) - **F1-Score**: Harmonic mean of precision and recall - **ROC-AUC**: Area under ROC curve - **Confusion Matrix**: Detailed breakdown of predictions ### Validation Methods - **Train-Test Split**: Simple holdout validation - **K-Fold Cross-Validation**: Divide data into k folds - **Stratified K-Fold**: Preserve class distribution in folds - **Time Series Split**: Respect temporal order - **Nested Cross-Validation**: Outer loop for evaluation, inner for tuning ### Bias-Variance Trade-off - **High Bias**: Underfitting, model too simple - **High Variance**: Overfitting, model too complex - **Sweet Spot**: Balance between bias and variance - **Regularization**: Reduce variance by adding constraints ## Model Interpretation ### Feature Importance - **Permutation Importance**: Shuffle feature values and measure impact - **SHAP Values**: Game-theoretic approach to feature attribution - **LIME**: Local interpretable model-agnostic explanations - **Partial Dependence Plots**: Show relationship between feature and predictions ### Model-Agnostic Methods - **SHAP**: Consistent, local feature attribution - **LIME**: Local linear approximations - **Permutation Importance**: Global feature importance - **Partial Dependence**: Global relationship visualization ### Model-Specific Methods - **Linear Models**: Coefficients directly show feature impact - **Tree-based Models**: Feature importance from split criteria - **Neural Networks**: Attention weights, saliency maps
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.