Fatskills
Practice. Master. Repeat.
Study Guide: Cloud ML - AWS Certified Machine Learning Engineer – Associate (MLA-C01): Algorithm Selection (Linear Learner, XGBoost, K‑Means, Random Cut Forest, LDA, PCA, etc.)
Source: https://www.fatskills.com/machine-learning-101/chapter/cloud-ml-cert-aws-ml-algorithm-selection-linear-learner-xgboost-kmeans-random-cut-forest-lda-pca-etc

Cloud ML - AWS Certified Machine Learning Engineer – Associate (MLA-C01): Algorithm Selection (Linear Learner, XGBoost, K‑Means, Random Cut Forest, LDA, PCA, etc.)

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~6 min read

AWS_ML – Algorithm Selection (Linear Learner, XGBoost, K‑Means, Random Cut Forest, LDA, PCA, etc.)


AWS Certified Machine Learning – Specialty: Algorithm Selection Study Guide

(Linear Learner, XGBoost, K-Means, Random Cut Forest, LDA, PCA, etc.)


What This Is

Algorithm selection is the process of choosing the right built-in SageMaker algorithm (or custom container) for your ML task based on data type, problem type (classification, regression, clustering, anomaly detection), and performance needs. This is critical because AWS SageMaker provides optimized, scalable implementations of common algorithms—saving you from writing custom code while ensuring cost-efficient training and inference.

Real-world scenario:
A fintech company needs to detect fraudulent transactions in real time. They have labeled historical data (fraud vs. non-fraud) with features like transaction amount, merchant category, and user behavior. They need a low-latency model that can scale to millions of transactions per day. The team must decide between XGBoost (for high accuracy) or Random Cut Forest (for unsupervised anomaly detection)—or even a hybrid approach.


Key Terms & Services

  • Amazon SageMaker Built-in Algorithms:
    Pre-optimized, containerized algorithms for training/inference. No need to write custom training loops—just provide data in the right format (e.g., CSV, protobuf, or Parquet).

  • Linear Learner:
    AWS’s scalable linear/logistic regression algorithm. Best for structured tabular data (e.g., credit scoring, sales forecasting). Supports L1/L2 regularization and automatic hyperparameter tuning.

  • XGBoost (SageMaker version):
    Gradient-boosted decision trees for classification, regression, and ranking. Handles missing values, imbalanced data, and feature importance out of the box. Default choice for most tabular problems (e.g., fraud detection, churn prediction).

  • K-Means:
    Unsupervised clustering for segmentation (e.g., customer groups, image compression). SageMaker’s version supports distributed training and automatic cluster initialization (k-means++).

  • Random Cut Forest (RCF):
    Unsupervised anomaly detection (e.g., fraud, network intrusions, sensor failures). Works by scoring how "surprising" a data point is based on random tree partitions. No labels needed—great for cold-start problems.

  • Principal Component Analysis (PCA):
    Dimensionality reduction for feature extraction (e.g., compressing high-dimensional data before training). SageMaker’s PCA supports sparse data and distributed computation.

  • Latent Dirichlet Allocation (LDA):
    Topic modeling for text data (e.g., document clustering, recommendation systems). Identifies hidden topics in a corpus (e.g., "sports," "politics").

  • Sequence-to-Sequence (Seq2Seq):
    Deep learning for time-series forecasting, machine translation, or text summarization. Uses LSTM/GRU architectures (e.g., predicting stock prices from historical data).

  • Object2Vec:
    Embedding generation for categorical data (e.g., user IDs, product IDs). Useful for recommendation systems (e.g., "users like you also bought...").

  • Bias-Variance Tradeoff:
    High bias (underfitting): Model is too simple (e.g., linear regression on complex data).
    High variance (overfitting): Model memorizes noise (e.g., deep decision trees).
    XGBoost/LightGBM balance this well with regularization and early stopping.

  • SageMaker Automatic Model Tuning (AMT):
    Hyperparameter optimization (HPO) using Bayesian optimization. Automatically searches for the best hyperparameters (e.g., max_depth in XGBoost, learning_rate).

  • SageMaker Inference Recommender:
    Automatically selects the best instance type for deployment (e.g., ml.m5.large vs. ml.g4dn.xlarge) based on latency, throughput, and cost.


Step-by-Step / Process Flow


How to Select and Train a SageMaker Algorithm

  1. Define the Problem Type
  2. Supervised? (Classification/Regression) → XGBoost, Linear Learner, Seq2Seq
  3. Unsupervised? (Clustering/Anomaly Detection) → K-Means, RCF, PCA
  4. Text/NLP?LDA, BlazingText, Seq2Seq
  5. Recommendations?Object2Vec, Factorization Machines

  6. Prepare Data in the Right Format

  7. Tabular data (CSV/Parquet): XGBoost, Linear Learner, RCF
  8. Text data (JSON/RecordIO): LDA, BlazingText
  9. Images (JPEG/PNG): Use SageMaker built-in CV algorithms (e.g., Image Classification, Object Detection)
  10. Time-series (CSV with timestamps): Seq2Seq, DeepAR

  11. Upload Data to S3

  12. Store training/validation data in S3 (e.g., s3://my-bucket/train/train.csv).
  13. Use SageMaker Processing or AWS Glue for ETL if needed.

  14. Choose the Algorithm & Configure Training Job

  15. Example (XGBoost for fraud detection):
    ```python
    from sagemaker.amazon.amazon_estimator import get_image_uri
    from sagemaker import Session

    sess = Session() container = get_image_uri(sess.boto_region_name, 'xgboost')

    estimator = sagemaker.estimator.Estimator(
    image_uri=container,
    role='SageMakerRole',
    instance_count=1,
    instance_type='ml.m5.large',
    output_path='s3://my-bucket/output',
    sagemaker_session=sess )

    estimator.set_hyperparameters(
    objective='binary:logistic',
    num_round=100,
    max_depth=5,
    eta=0.2 )

    estimator.fit({'train': 's3://my-bucket/train/', 'validation': 's3://my-bucket/val/'}) ```

  16. Deploy the Model for Inference

  17. Real-time endpoint: estimator.deploy(initial_instance_count=1, instance_type='ml.t2.medium')
  18. Batch transform: estimator.transformer(instance_count=1, instance_type='ml.m5.large').transform(...)
  19. Use Inference Recommender to optimize instance type.

  20. Monitor & Iterate

  21. CloudWatch Metrics: Track Invocations, Latency, ModelError.
  22. SageMaker Model Monitor: Detect data drift (e.g., feature distributions changing over time).
  23. A/B Testing: Deploy multiple models and route traffic using SageMaker Endpoints.

Common Mistakes

Mistake Correction
Using K-Means for supervised problems K-Means is unsupervised—use XGBoost or Linear Learner for labeled data.
Assuming XGBoost is always the best choice For high-dimensional sparse data (e.g., text), BlazingText or LDA may work better. For anomaly detection, RCF is simpler and faster.
Ignoring data format requirements SageMaker algorithms expect specific formats (e.g., XGBoost needs CSV/Parquet without headers, LDA needs tokenized text in JSON).
Not using Automatic Model Tuning (AMT) Manually tuning hyperparameters is time-consuming and suboptimal. Use Bayesian optimization in SageMaker AMT.
Deploying on oversized instances Use Inference Recommender to pick the cheapest instance that meets latency/throughput needs.


Certification Exam Insights


What the Exam Tests

  1. Algorithm Selection Traps
  2. "When to use XGBoost vs. Linear Learner?"
    • XGBoost: Best for non-linear relationships, imbalanced data, feature importance.
    • Linear Learner: Best for linear relationships, interpretability, fast training.
  3. "When to use RCF vs. K-Means?"


    • RCF: Anomaly detection (no labels needed).
    • K-Means: Clustering (grouping similar data points).
  4. Data Format Requirements

  5. XGBoost: CSV/Parquet without headers, no missing values (unless handled in preprocessing).
  6. LDA: Tokenized text in JSON (e.g., {"text": ["word1", "word2"]}).
  7. PCA: Dense or sparse matrices (supports libsvm format).

  8. Cost & Performance Tradeoffs

  9. Batch vs. Real-time Inference:
    • Batch: Cheaper (e.g., ml.m5.large for offline predictions).
    • Real-time: More expensive (e.g., ml.g4dn.xlarge for low-latency needs).
  10. Distributed Training:


    • XGBoost: Supports multi-instance training (faster for large datasets).
    • K-Means: Single-instance only (unless using SageMaker Distributed).
  11. Hybrid Approaches

  12. "How to combine PCA + XGBoost?"
    • Use PCA for dimensionality reductionXGBoost for classification.
  13. "How to use RCF for fraud detection?"
    • Train RCF on normal transactionsflag anomaliesretrain XGBoost on labeled anomalies.

Quick Check Questions

  1. A retail company wants to segment customers into 5 groups based on purchase history. The data is tabular (CSV) with 20 features. Which SageMaker algorithm should they use?
  2. Answer: K-Means (unsupervised clustering for segmentation).
  3. Why? K-Means is designed for grouping similar data points without labels.

  4. A bank needs to detect fraudulent transactions in real time. They have labeled historical data (fraud vs. non-fraud) with 50 features. Which algorithm should they deploy for low-latency inference?

  5. Answer: XGBoost (supervised, handles imbalanced data, fast inference).
  6. Why? XGBoost is optimized for tabular data and supports real-time endpoints.

  7. A manufacturing company wants to detect defective products on an assembly line using sensor data. They don’t have labeled defects. Which algorithm should they use?

  8. Answer: Random Cut Forest (RCF) (unsupervised anomaly detection).
  9. Why? RCF doesn’t require labels and works well for time-series/sensor data.

Last-Minute Cram Sheet

  1. XGBoost = Default for tabular data (classification/regression). Handles missing values, imbalanced data.
  2. Linear Learner = Fast, interpretable (linear/logistic regression). Good for high-bias problems.
  3. K-Means = Clustering (segmentation). Not for supervised problems!
  4. RCF = Anomaly detection (no labels needed). Faster than deep learning for tabular data.
  5. PCA = Dimensionality reduction (feature extraction). Use before training if data is high-dimensional.
  6. LDA = Topic modeling (text data). Not for classification!
  7. Seq2Seq = Time-series forecasting, NLP (e.g., stock prices, machine translation).
  8. Object2Vec = Embeddings for categorical data (e.g., user/product IDs).
  9. ⚠️ XGBoost expects CSV/Parquet without headers! (Use header=False in Pandas.)
  10. ⚠️ K-Means requires specifying k (number of clusters) upfront! (Use Elbow Method to choose.)


ADVERTISEMENT