Based on the MLS-C01 exam guideReport an error
use_pretrained_model=1 transfer learning + data augmentation. If you also need object locations, use Object Detection.Yesterday we covered tabular-data algorithms. Today we organize the specialized builtins used when the data has a special shape: text, images, time series, and sparse interactions.
| Data shape | Goal | Builtin | Input format | Reason |
|---|---|---|---|---|
| Text | Document classification | BlazingText (supervised) | Text file, __label__<label> sentence | Based on fastText, very fast on large corpora |
| Text | Word embeddings | BlazingText (Word2Vec) | Text file (whitespace-tokenized) | Learns a semantic space without labels |
| Image | Label classification | Image Classification | RecordIO or images (.jpg/.png) + .lst | ResNet-based CNN, supports transfer learning |
| Image | Object location | Object Detection | — | Location is needed, not just classification |
| Image | Pixel level | Semantic Segmentation | — | Assigns a class to every pixel |
| Time series | Forecast future values | DeepAR | JSON Lines | Shared learning across many related series, probabilistic forecasts |
| Sparse interactions | Recommendation, click prediction | Factorization Machines | RecordIO-protobuf (float32) | Optimized for sparse data |
[Data is not tabular]
│
┌───────────┬───────┴────────┬─────────────┐
Text Image Time series User-item
│ │ │ (very sparse)
Labels? What do you Many related │
├─ Yes → want? series? Factorization
│ supervised ├─ Label only → ├─ Yes → Machines
│ (document │ Image │ DeepAR (RecordIO-protobuf)
│ classif.) │ Classification └─ No →
└─ No → ├─ Location too → Single-series statistical
Word2Vec │ Object method or Forecast
(embedding)│ Detection
└─ Pixel level →
Semantic Segmentation
A builtin that accelerates Word2Vec and text classification on GPUs. It has two modes.
Mode decision:
Labels exist and you classify documents → supervised (text classification)
No labels and you only need word vectors → Word2Vec (cbow / skipgram / batch_skipgram)__label__<label> sentence format| Word2Vec mode | Training direction | Characteristics |
|---|---|---|
| cbow | Predict the center word from the surrounding context | Fast and strong on frequent words |
| skipgram | Predict the surrounding context from the center word | Better representations of rare words |
| batch_skipgram | Batched, distributed training version of skipgram | Scalability on large corpora |
BlazingText's Word2Vec places words with similar meanings close together in the vector space by either "guessing the center word from its context (CBOW)" or "guessing the context from the center word (skip-gram)." The learned embeddings themselves can be used for word similarity search, or passed to other models as input features. On the exam, "semantic similarity of words" / "embeddings" is the signal for Word2Vec mode, and "classify documents into categories" is the signal for supervised mode.
⚠️ Trap: In supervised mode, the label prefix in the training file must take the form
__label__. An option that puts the label in a column like a regular CSV is wrong.
A builtin that classifies images into one or multiple labels using a CNN (ResNet).
use_pretrained_model=1 gives good performance even with little dataKey hyperparameters:
num_classes, num_training_samples
use_pretrained_model 0 (from scratch) | 1 (transfer learning)
image_shape, learning_rate, mini_batch_size
augmentation_type image augmentation (crop/color, etc.)| Situation | Choice | Reason |
|---|---|---|
| Fewer than a few thousand labeled images | use_pretrained_model=1 + augmentation_type | Training from scratch overfits |
| Very many labeled images and a specialized domain | Consider use_pretrained_model=0 | When the domain differs greatly from the pretraining domain |
| "Does this photo have a defect?" | Image Classification | Only a label is needed |
| "Where is the defect?" | Object Detection | Bounding boxes are needed |
| "Paint the defect region pixel by pixel" | Semantic Segmentation | Pixel-level classes |
⚠️ Trap: Choosing "train a deeper network from scratch" for "images + insufficient data" is wrong. The less data you have, the more you should borrow pretrained weights and expand the data with augmentation rather than enlarge the model.
An RNN-based time series forecasting builtin. Its key strength is that it does not model each series separately but learns multiple related series together and shares patterns.
start, target, and optionally cat (category) and dynamic_feat (covariates)Key hyperparameters:
context_length length of the past input window
prediction_length length of the forecast window
epochs, num_cells, num_layers
likelihood output distribution (Gaussian, etc.)Traditional ARIMA and exponential smoothing model each time series separately, whereas DeepAR trains multiple related series in a single model and cross-learns seasonality and trend. That is why a new item with a short history can borrow the patterns of similar items. Because the output is a distribution (quantiles) rather than a point estimate, it provides uncertainty intervals in the form of P10/P50/P90. On the exam, "thousands of related time series" / "new product demand" / "probabilistic forecast intervals" are DeepAR signals. If you need something more managed, Amazon Forecast is the answer.
| Condition | DeepAR | Single-series statistical techniques (ARIMA, etc.) |
|---|---|---|
| Thousands of related series | Advantageous (shares patterns) | A separate model must be built for each series |
| New or short history (cold start) | Advantageous (borrows from similar series) | Cannot estimate without data |
| Only a single time series | Small advantage | Competitive enough |
| Uncertainty intervals needed | Provides quantile forecasts | Separate interval estimation required |
| Reflecting covariates (promotions, price) | Fed in via dynamic_feat | Awkward to extend |
"Time series forecasting" does not automatically mean DeepAR. If there is only one series and the data is short, deep learning is overkill. DeepAR is confirmed only when there is a clue such as "many related series" or "probability intervals needed."
It efficiently models second-order interactions between features in data that is very sparse and high-dimensional, such as user-item data.
Key hyperparameters:
num_factors dimension of the latent factors
predictor_type binary_classifier | regressor
bias/linear/factors per-term regularization and initialization settingsIn a recommendation context, FM is a generalization of collaborative filtering. If you feed in user ID and item ID as one-hot vectors, it behaves like matrix factorization, and you can also feed additional features (time, context) alongside them.
| Comparison | Factorization Machines | Classic collaborative filtering (matrix factorization) |
|---|---|---|
| Input | Arbitrary feature vector (one-hot + extra features) | Only the user-item matrix |
| Side information | Time, context, demographics can be added | Hard to add |
| Cold start | Partly mitigated by extra features | Weak on new users and items |
| Handling sparsity | Generalizes interactions through latent factors | Focuses on observed cells |
An option that says to use CSV with FM is a wrong-answer signal. Representing sparse high-dimensional data as CSV produces a huge dense table that is mostly zeros, which is inefficient. RecordIO-protobuf (float32) is the correct answer.
Specialized builtins have different preprocessing requirements from tabular algorithms. In some cases the very concept of "scaling" does not apply.
| Builtin | Preprocessing requirement | Scaling |
|---|---|---|
| BlazingText | Whitespace tokenization; __label__ prefix for supervised | Not applicable (token input) |
| Image Classification | Resize (image_shape), augmentation, build RecordIO or .lst | Pixel normalization is handled by the container |
| DeepAR | Organize start/target per series, handle missing intervals, align covariates | Not applicable (series scale is normalized internally) |
| Factorization Machines | One-hot encode, then convert to a sparse representation | Scale cleanup recommended for numeric features |
| Task | Main metric | What it tells you | Trap |
|---|---|---|---|
| Text classification (imbalanced classes) | F1, macro F1 | Whether minority categories are also caught | Accuracy is pulled toward the majority category |
| Image classification (multi-label) | Per-label precision/recall | Performance variation across tags | Overall accuracy hides the variation |
| Time series forecasting (point estimate) | RMSE, MAE | Average size of the error | Says nothing about the quality of interval forecasts |
| Time series forecasting (probability interval) | Quantile loss family | Whether the P10/P50/P90 interval encloses the actual value | With RMSE alone you cannot tell if the interval is too wide |
| Recommendation (click prediction) | AUC, PR-AUC | Quality of click-probability ranking | Accuracy is meaningless when the click rate is under 1% |
| Recommendation (rating prediction) | RMSE | Rating error | A different matter from top-ranking quality |
Recommendation and click-prediction data is a classic imbalance case, with very few positives (clicks). An option that picks accuracy as the metric here is wrong; AUC, which looks at ranking quality, or PR-AUC, which is honest about the minority class, is the correct direction.
| Question clue | Answer direction | Accompanying details |
|---|---|---|
| "Classify documents into categories" | BlazingText supervised | __label__ format |
| "Semantic similarity of words / embeddings" | BlazingText Word2Vec | cbow / skipgram |
| "Images + little data" | Image Classification | Transfer learning + augmentation |
| "Object locations in images" | Object Detection | Not classification |
| "Separate regions pixel by pixel" | Semantic Segmentation | — |
| "Thousands of related series / new product demand / P90 interval" | DeepAR | JSON Lines, context_length |
| "Also reflect external variables such as promotions" | DeepAR dynamic_feat | Covariate channel |
| "User-item / very sparse / recommendation" | Factorization Machines | RecordIO-protobuf |
| "Fully managed and fast" | Comprehend / Rekognition / Forecast / Personalize | Not training it yourself |
Tomorrow we cover the unsupervised and anomaly-detection builtins that work without labels (RCF, PCA, IP Insights, LDA/NTM).
num_factors sets its dimension.Click a choice to reveal the answer and explanation.
Question 1
You have daily sales data for 1,000 stores and want to forecast the next 4 weeks of demand, as P10/P50/P90 intervals, for a newly opened store with a short data history. Which built-in algorithm is MOST suitable?
Question 2
You want to train a model that classifies customer review documents as "positive/negative/neutral" on a large corpus very quickly. Which built-in algorithm and mode are MOST suitable?
Question 3
You want to classify product defects using a small image dataset of about 2,000 images. With so little data, you are worried about performance. Which approach is MOST recommended?
Question 4
You one-hot encoded user ID, item ID, and context features to create very sparse, high-dimensional click-through-rate prediction data. Which built-in algorithm efficiently learns the interactions, and what is the recommended input format?
Question 5
In which situation is it MOST appropriate to use BlazingText's Word2Vec mode?