Guides

Practical Decision Support

Formal scenario-based guidance for selecting methods, metrics, and deployment strategies. For conceptual background, consult the Learn sequence first.

Model Selection Guide

If the data are tabular and interpretability is required, begin with linear models or decision trees before proceeding to more complex ensembles. If the relationship is strongly nonlinear and data volume permits, compare tree ensembles or neural networks under cross-validation.

I have tabular data. What model should I try?

Structured rows and columns—spreadsheet-like or database features.

Recommended

  • — Logistic Regression (baseline, interpretable)
  • — Decision Tree (rules, mixed types)
  • — Random Forest (strong default)
  • — Gradient Boosting (competitive accuracy)
  • — Linear SVM (compact, good for embedded linear case)

Avoid

  • — Large transformers without enough data and justification
  • — Skipping train/validation split

Key metrics: Task-appropriate metric: F1/ROC-AUC for imbalance, RMSE/MAE for regression; Calibration if thresholds matter

I need embedded or TinyML deployment

Microcontroller or strict flash/SRAM/latency limits.

Recommended

  • — Linear SVM
  • — Decision Tree
  • — Small Random Forest (watch size)
  • — Quantized small neural network (TFLite Micro)

Avoid

  • — k-NN storing full training set on device (memory-heavy)
  • — Large unpruned forests
  • — Deploying without Python → C → device prediction checks

Key metrics: Latency per inference; Flash and SRAM footprint; Accuracy after quantization

I have too many features

High dimensionality, redundancy, or risk of overfitting.

Recommended

  • — Feature selection (filter/wrapper methods)
  • — PCA for linear compression
  • — Regularization (L1/L2)
  • — Embeddings for text/high-cardinality categoricals

Avoid

  • — Fitting PCA on full dataset including test
  • — Using test set to pick features

Key metrics: Validation performance vs number of features; Inference time and memory

I need text understanding

Classification, search, Q&A, or generation over language.

Recommended

  • — Tokenization
  • — Embeddings
  • — Transformer encoders (BERT-style) for understanding
  • — RAG for knowledge-grounded answers
  • — LLMs for flexible generation with guardrails

Avoid

  • — LLM-only without evaluation or grounding for factual tasks
  • — Tokenizer mismatch across train/deploy

Key metrics: Task-specific accuracy/F1; Retrieval recall for RAG; Human eval for generation

I need interpretability

Regulatory, clinical, or stakeholder need to explain decisions.

Recommended

  • — Linear or logistic regression
  • — Decision Tree (single tree for rules)
  • — Feature importance from Random Forest (with caveats)
  • — Clear metric reporting and documentation

Avoid

  • — Defaulting to deep learning without explainability plan
  • — Overstating importance from correlated features

Key metrics: Performance on validation; Explanation stability across similar inputs

Evaluation Metric Guide

Metric selection should reflect the task objective, class distribution, risk level, and cost of false positives or false negatives. If the dataset is imbalanced, accuracy should be supplemented with precision, recall, F1-score, ROC-AUC, and the confusion matrix.

My dataset is imbalanced

One class is rare but often more important (fraud, defect, disease).

Recommended

  • — Precision, Recall, F1-score
  • — ROC-AUC or PR-AUC
  • — Class weighting or stratified sampling
  • — Threshold tuning on validation set

Avoid

  • — Reporting accuracy alone
  • — Using random split without stratification for classification

Key metrics: Recall at acceptable precision; Confusion matrix by class

Deployment Guide

If deployment is constrained by memory, evaluate model size, firmware size, SRAM use, and inference latency in addition to accuracy. Conduct sample-level verification between the training framework, exported runtime, and target device.

I need embedded or TinyML deployment

Microcontroller or strict flash/SRAM/latency limits.

Recommended

  • — Linear SVM
  • — Decision Tree
  • — Small Random Forest (watch size)
  • — Quantized small neural network (TFLite Micro)

Avoid

  • — k-NN storing full training set on device (memory-heavy)
  • — Large unpruned forests
  • — Deploying without Python → C → device prediction checks

Key metrics: Latency per inference; Flash and SRAM footprint; Accuracy after quantization

I need better deployment efficiency

Model too slow, large, or costly for target environment.

Recommended

  • — Quantization
  • — Pruning
  • — Knowledge distillation
  • — Feature reduction
  • — Hardware-aware architecture search

Avoid

  • — Stacking compression steps without re-measuring accuracy
  • — Ignoring preprocessing cost in latency

Key metrics: Latency p50/p99; Model size; Energy per inference; Accuracy drop vs float baseline

Common Errors

Using accuracy as the only metric

Purpose of correction: On imbalanced data, a useless majority-class classifier can look excellent.

Recommended practice: Use precision, recall, F1, ROC-AUC, or cost-weighted metrics aligned with failure costs.

Ignoring class imbalance

Purpose of correction: Rare but critical events (fraud, defects) get missed while accuracy stays high.

Recommended practice: Stratified splits, class weights, resampling with care, threshold tuning.

Scaling or normalizing the full dataset before splitting

Purpose of correction: Test distribution statistics leak into training—optimistic validation.

Recommended practice: Fit scalers on training data only; apply the same transform to val/test.

Tuning hyperparameters on the test set

Purpose of correction: Test set ceases to be an unbiased estimate of generalization.

Recommended practice: Use validation set or cross-validation; touch test set once at the end.

Not saving random seeds

Purpose of correction: Results cannot be reproduced or compared across experiments.

Recommended practice: Fix seeds for splits, initialization, and document library versions.

Not documenting preprocessing

Purpose of correction: Training-serving skew breaks production models silently.

Recommended practice: Version preprocessing pipelines with the model artifact.

Choosing complex models before baselines

Purpose of correction: Wastes time and hides whether simple methods already solve the problem.

Recommended practice: Start with logistic regression, trees, or linear models; justify added complexity.

Ignoring deployment constraints during model selection

Purpose of correction: Accurate cloud models may be undeployable on device or within latency SLA.

Recommended practice: Define latency, memory, and power budgets before final selection.

Ignoring memory and latency in embedded ML

Purpose of correction: k-NN and large forests can exceed flash/SRAM; inference misses real-time deadlines.

Recommended practice: Benchmark on target hardware; compare quantized vs float predictions.

Assuming export to C/device matches Python predictions

Purpose of correction: Quantization and numeric differences cause silent wrong outputs.

Recommended practice: Sample-by-sample compare Python → exported C → microcontroller.

Confusing feature selection with feature extraction

Purpose of correction: Selection keeps original features; extraction creates new representations (PCA, embeddings).

Recommended practice: Name the step correctly and validate on held-out data after the transform.

Confusing validation results with final test results

Purpose of correction: Repeated validation peeking overfits the validation process.

Recommended practice: Report validation for development; hold out test for final claim only.

Overusing acronyms without understanding their purpose

Purpose of correction: Tools get applied to wrong problems; teams talk past each other.

Recommended practice: For each term, ask: what problem does it solve and where in the pipeline does it live?

Comparison Tables

Classical ML algorithms (Gen 1)

Tabular data starting points—compare before defaulting to boosting or deep learning.

AlgorithmBest forWatch out for
Logistic RegressionLinear-ish boundaries, interpretabilityNeeds scaling; weak on complex nonlinear without features
SVMMedium data, margin-based classificationSlow on huge data; kernel tuning
Decision TreeRules, mixed feature typesHigh variance alone; overfitting
Random ForestStrong tabular defaultSize on embedded; less interpretable than one tree
k-NNSimple baseline, local patternsMemory at inference; scaling required

Classification metrics

Choose metrics that match misclassification costs—not convenience.

MetricEmphasizesWeak when
AccuracyOverall correctnessClasses imbalanced
PrecisionFalse positive costMissing positives is cheap
RecallFinding positivesFalse alarms are very costly
F1Balance precision & recallAsymmetric costs need weighting
ROC-AUCRanking across thresholdsCalibration at one threshold matters most

Deployment: Python vs exported C vs microcontroller

StageRoleRisk
Python trainingExperimentation, gold labelsNot production runtime on MCU
Exported C / TFLMFirmware integrationNumeric/quantization mismatch
On-device inferenceReal latency & memoryPreprocessing drift from training

Optimization: Quantization vs Pruning vs Distillation

MethodReducesTrade-off
QuantizationPrecision, size, speedAccuracy drop if not validated
PruningWeights/neuronsMay need retraining
DistillationModel capacity via studentExtra training pipeline
Feature reductionInput dimensionInformation loss

Gen 1 vs Gen 2 vs Gen 3 AI

GenerationCore ideaTypical constraint
Gen 1Patterns from structured featuresFeature engineering quality
Gen 2Learned representations (layers)Data & compute
Gen 3Attention & scaleCost, evaluation, safety