Instiq
Chapter 3 · Modeling·v2.1.0·Updated 6/14/2026·~12 min

What's changed: In-scope coverage: added core service explanations

3.1Choosing Algorithms

Key points

Match the model to the task—understand supervised (classification/regression), unsupervised (clustering/dimensionality reduction), SageMaker built-in algorithms, and specialized tasks (images/text/time series).

The first step of modeling is to choose an algorithm that matches the task. The choice hinges on whether you have labels and the type of output.

3.1.1Choose by task type

Diagram of choosing an ML algorithm: starting from "what is the task (labels? output type?)", it splits into supervised (classification with XGBoost/Linear Learner, regression to predict numbers, labeled data), unsupervised (clustering with K-Means, dimensionality reduction with PCA, anomaly detection with RCF, no labels), and specialized (images with CNN/Image Classification, text/sequence with BlazingText/seq2seq, forecasting with DeepAR, domain-specific); labels → supervised, no labels → unsupervised, images/text/time → specialized.
Choosing an ML algorithm
  • Supervised: train on labeled data. Classification (XGBoost/Linear Learner) or regression (predict numbers).
  • Unsupervised: no labels. Clustering (K-Means), dimensionality reduction (PCA), anomaly detection (Random Cut Forest).
  • Specialized: images (image classification/CNN), text (BlazingText), time-series forecasting (DeepAR).
  • SageMaker built-ins: many of the above are provided as built-in algorithms, ready to use.
Exam point

Common on MLS-C01: tabular classification/regression = XGBoost, clustering = K-Means, dimensionality reduction = PCA, anomaly detection = Random Cut Forest, time-series forecasting = DeepAR, text classification/embeddings = BlazingText. First split by labels (supervised/unsupervised), then pick by output type.

MLS-C01 probes "which SageMaker built-in, when" deeply. For tabular data, XGBoost (gradient-boosted trees) is the strong default—robust to missing values and scale, usable for classification, regression, and ranking. Consider Linear Learner for large near-linear or sparse data, Factorization Machines for recommendation/collaborative filtering, and kNN or Linear Learner for very large multiclass classification. For unsupervised work, choose K-Means for spherical clusters (k must be set—use the elbow method or silhouette), PCA for dimensionality reduction and visualization prep, Random Cut Forest (RCF) for streaming anomaly detection, and LDA/NTM for topic modeling. For specialized tasks, use Image Classification (ResNet-based, transfer learning), Object Detection, semantic segmentation, BlazingText for text (Word2Vec embeddings + fast text classification), Seq2Seq for sequence transduction (translation/summarization), and DeepAR for time series (trains across many series for probabilistic forecasts, strong at cold start). Higher-level options include SageMaker Autopilot (AutoML) to auto-search the best model and hyperparameters without code, Bring Your Own Container, and script mode for Hugging Face/PyTorch/TensorFlow—decide "built-in vs AutoML vs custom" by requirements (accuracy/effort/explainability/customization). When an algorithm’s assumptions break (K-Means assumes spherical isotropic clusters, PCA is linear, linear regression assumes linearity/homoscedasticity), consider alternatives (DBSCAN, kernel methods, tree-based).

TaskTypical algorithmNote
Tabular classification/regressionXGBoostRobust to missing/scale; strong default
ClusteringK-MeansSet k, spherical (DBSCAN if not)
Dimensionality reductionPCALinear; prep for visualization
Streaming anomaly detectionRandom Cut ForestAlso in Kinesis Analytics
Time-series forecastingDeepARMany series, probabilistic, cold start
Text classification/embeddingsBlazingTextWord2Vec, fast
Note

Scenario: forecast demand for hundreds of stores from daily sales. Building a separate model per store is inefficient, and you also want to forecast new stores with short history. → Use DeepAR. It trains many series together as one global model, sharing patterns across series and producing probabilistic forecasts even for shallow-history (cold-start) series—more efficient and often more accurate than fitting a separate ARIMA per store.

Note

FAQ: Q. What to try first on tabular data? A. XGBoost—robust and a strong default; Linear Learner if near-linear/sparse. Q. How to pick k clusters? A. Evaluate with the elbow method or silhouette; use DBSCAN for non-spherical. Q. Best model without writing code? A. SageMaker Autopilot (AutoML) auto-searches preprocessing/model/HPs and produces a leaderboard and explainability report.

Warning

Trap: "just use XGBoost or K-Means for time-series forecasting" is often wrong—DeepAR fits seasonality/trend and cross-series learning, and K-Means is clustering, not forecasting. Also "classify with PCA" is wrong—PCA is dimensionality reduction, not a classifier. Match the algorithm to the task (output type).

3.1.2Section summary

  • Labeled = supervised (XGBoost etc.) / unlabeled = unsupervised (K-Means/PCA/RCF)
  • Time series = DeepAR; text = BlazingText

Sign in to track progress — Log in.

Quick check

(just a quick review)

Q1. Group unlabeled customer data into similar clusters. Which algorithm?

Q2. Forecast future demand from past sales as a time series. Which SageMaker built-in?

Q3. Compress many features into fewer dimensions while preserving information. What?

Check your understandingPractice questions for Chapter 3: Modeling