Choosing the right ML “shape” for the job

A product team wants to reduce fraudulent card transactions. The data is rich—amount, merchant type, device, location, past behavior—but the outcome is messy. Sometimes you want a hard decision (“block” vs “allow”). Other times you want a risk score so an analyst can review the top 0.1%. And sometimes you don’t even have clear “fraud” labels yet—you just want to spot strange behavior worth investigating.

That’s the practical reason to learn core ML problem types: they tell you what kind of output your model will produce, what kind of data you need, and how you’ll measure success without fooling yourself. If you pick the wrong problem type, you’ll optimize the wrong objective, celebrate misleading metrics, and ship something that fails in production despite looking good offline.

This lesson gives you a mental menu of the most common ML problem types, what they assume, and the traps beginners fall into.

The four building blocks: inputs, outputs, feedback, and evaluation

A useful way to classify ML problems is by answering four questions:

  • What are the inputs (features)? The evidence the model gets at prediction time: text, images, transactions, tabular records, clicks, sensor readings.

  • What is the output? A category, a number, a ranked list, a grouping, or generated content.

  • What feedback do you have? Do you have labels (ground-truth outcomes), weak signals (clicks), delayed signals (chargebacks days later), or no labels at all?

  • How will you evaluate generalization? What metric should improve on unseen data, and what would count as a harmful tradeoff?

The big dividing line is supervised vs. unsupervised learning. Supervised learning uses labeled examples (input → target) and dominates production ML because it’s testable: you can hold out data and measure generalization. Unsupervised learning looks for structure without labels (clusters, anomalies, embeddings), which is powerful when labels are missing—but easier to misuse because “good” is less clearly defined.

One more idea from earlier: a model can look “accurate” for the wrong reasons if you leak information or evaluate improperly. Problem type and evaluation design are inseparable—your choice of output shape should match your success definition and what’s available at inference time.

A practical map of core ML problem types

The table below is a quick orienting reference. You’ll revisit these categories constantly.

Dimension Classification Regression Ranking / Recommendation Clustering / Anomaly detection Generation (language/vision/audio)
What you predict A discrete label (spam/not spam, fraud/not fraud) or a class among many A number (price, demand, time-to-failure) An ordered list (top results, top products) or “best next item” Groups of similar items or rare/odd cases New content (text, image, code, speech)
Typical output Class + probability/score Numeric value + sometimes uncertainty Scores per item, then sorted Cluster IDs, distance scores, anomaly scores Tokens/pixels generated step-by-step
Data you need Labeled examples; careful definition of labels Labeled numeric targets; consistent measurement Interaction logs + implicit/explicit feedback; counterfactuals are hard Often no labels; relies on feature representation Large corpora; strong data governance and safety constraints
How you evaluate Accuracy, precision/recall, ROC-AUC; plus error analysis by subgroup MAE/MSE/RMSE; calibration; residual analysis NDCG, MAP, CTR/Conversion; online testing often needed Qualitative inspection, downstream utility, anomaly hit-rate Human eval + task metrics; safety/quality checks
Common pitfall Optimizing the wrong tradeoff (e.g., recall vs precision) Predicting a number when the decision needs a thresholded action Treating clicks as “truth” and creating feedback loops Mistaking “interesting clusters” for business value Assuming it “understands” and skipping guardrails
Best use when You need a decision boundary and can define labels Quantity matters and errors have a meaningful scale You must choose among many options for each user/query You need discovery, monitoring, triage before labels exist You need content creation/assistance, not just prediction

Supervised learning: classification and regression (and why they’re more similar than they look)

Classification is the workhorse: predict which bucket an example belongs to. Spam filtering is classic binary classification (spam vs not spam), but classification also covers multi-class problems (which product category?) and multi-label problems (an email can be both “promotions” and “social”). Most classification models don’t truly output a “yes/no” first; they output a score that you turn into a decision with a threshold. That’s why tradeoffs like precision vs. recall matter: high recall catches more spam/fraud, but high precision reduces false alarms that frustrate users or block good customers.

The biggest best practice in classification is to treat it as decision-making under uncertainty. Start by defining the cost of errors: is a false negative worse (letting fraud through) or is a false positive worse (blocking legitimate payments)? Then choose metrics that reflect that reality rather than chasing a single vanity number like accuracy—which can be meaningless on imbalanced data (e.g., 99.9% legitimate transactions). Common pitfalls from real ML workflows show up immediately here: label noise (fraud labels arrive late or are disputed), data leakage (using a feature that encodes the outcome), and metric mismatch (optimizing offline AUC while business outcomes worsen).

Regression predicts a numeric value, but it shares the same core idea: learn a mapping from features to a target that generalizes. The difference is the output space: continuous rather than categorical. Regression is a good fit when the magnitude of error matters (predicting delivery time, demand, energy usage). It’s a poor fit when the real decision is categorical or policy-driven. A common beginner mistake is using regression because “it feels more precise,” then later turning the predicted number into a thresholded action—creating a hidden classification problem with poorly chosen thresholds and unclear evaluation.

Best practices in regression emphasize error interpretation and robust evaluation. A low average error can still hide dangerous pockets where the model fails systematically (certain locations, devices, user segments). Residual analysis and subgroup breakdowns matter as much as overall MAE or RMSE. Another common pitfall is forgetting that the environment changes: if pricing behavior or seasonality shifts, the mapping learned from historical data drifts. Regression models can look stable offline yet degrade subtly until monitoring catches it—if you instrument monitoring at all.

Ranking and recommendation: when the output is a list, not a label

Ranking problems show up any time you’re choosing the best option among many: search results, recommended videos, which ads to show, which support ticket to route first. The output isn’t “this is spam” or “this will happen”; it’s an ordering of items by predicted usefulness. That changes everything about evaluation. Improving the model’s score for the top position matters more than small improvements at the bottom, and user behavior introduces complex feedback loops: what you show influences what gets clicked, which then becomes training data.

A best practice mindset here is to separate prediction from decision policy. The model usually produces relevance scores per candidate item, but the system also applies constraints (diversity, freshness, safety, business rules). Many production systems blend ML and rules intentionally: ML provides a flexible ranking signal; rules enforce non-negotiables. A common misconception is that recommendation is “just classification per item” (“will the user click?”). Click prediction can be a useful signal, but clicks are not the same as satisfaction, and optimizing clicks blindly can lead to shallow engagement or misleading outcomes.

Pitfalls are especially sharp because evaluation is hard. Offline metrics can be misleading if your logs reflect an old policy: you mostly observe outcomes for items you already chose to show. That means the training and evaluation data are biased by prior decisions. In practice, teams often need careful experimentation and monitoring to confirm improvements. Even at a beginner level, the key lesson is conceptual: ranking is about relative preference, and you should expect feedback loops and metric mismatch unless you design for them.

Unsupervised learning: clustering and anomaly detection as “structure without labels”

When you don’t have labels, you can still do useful ML by looking for structure in the feature space. Clustering groups similar items together—customers with similar behavior, articles with similar topics, devices with similar telemetry patterns. The output is not a “truth label”; it’s an organizational tool. That’s why clustering is often a step in exploration, segmentation, or building features for later supervised models rather than a final product decision.

Anomaly detection is a close cousin: instead of grouping typical patterns, it flags what looks rare or far from normal. This is common in fraud triage, monitoring, cybersecurity, and equipment failure detection—especially before you can define reliable labels. The best practice is to treat anomaly scores as a queueing and investigation aid, not an automatic blocker, unless you’ve validated the cost of false alarms. In many organizations, anomaly detection becomes powerful when paired with humans-in-the-loop: analysts review the top anomalies, then those reviewed cases become labeled data that can later support supervised learning.

The biggest pitfall is over-interpreting outputs. Clusters can be artifacts of scaling choices or representation, and “we found 7 clusters” doesn’t mean there are 7 real customer types. Similarly, anomalies are not necessarily “bad”; they can be new legitimate behavior. This connects directly to earlier workflow pitfalls: if your training data doesn’t match deployment data, what counts as “normal” shifts. Without monitoring, unsupervised systems can quietly become noisy or blind as the world changes.

[[flowchart-placeholder]]

Applied example 1: spam filtering (classification with real tradeoffs)

Spam filtering maps cleanly to binary classification, but the details determine whether it works. Step one is defining the label: what counts as spam—commercial newsletters, scams, phishing, unwanted promotions? That policy choice shapes the training data and the model’s behavior. You then collect labeled examples and ensure you split them for honest evaluation so you can measure generalization rather than memorization.

At inference time, the model produces a score that you threshold. This is where precision and recall become practical engineering knobs. If you push for very high recall, you catch more spam but risk false positives—hiding legitimate mail, which is often a worse user experience than letting some spam through. Many real systems add decision tiers: confidently spam → spam folder; uncertain → deliver but warn; confidently safe → inbox. This is a typical pattern of combining ML scores with product policy.

Limitations and failure modes mirror the earlier workflow warnings. Attackers adapt language and formatting, creating distribution shift. User feedback can create feedback loops: if mail is hidden, users can’t correct it, and your “ground truth” becomes biased. Leakage can creep in if you accidentally use features that encode post-delivery outcomes. Done well, spam filtering is a strong example of choosing the right problem type, aligning metrics to costs, and monitoring drift over time.

Applied example 2: payment fraud (classification, ranking, and anomaly detection in one system)

Fraud detection often starts as classification: predict fraud vs legit using features like transaction amount, merchant category, device fingerprint, location consistency, and velocity patterns. The model typically outputs a risk score, not certainty. The decision layer then sets thresholds based on business tolerance: auto-approve low risk, step-up authenticate medium risk, block or send to manual review at high risk. This is classification in form, but it’s decision engineering in practice.

Many fraud teams also treat the problem as ranking: given millions of transactions, which should analysts review first? That’s a ranking objective over cases, not just per-transaction labels. The benefit is operational: you can allocate scarce investigator time to the highest expected value queue. This is also where metric mismatch can bite—optimizing AUC might not improve “fraud dollars prevented per analyst hour” unless you choose thresholds and review policies intentionally.

Finally, fraud systems often use anomaly detection to discover new attack patterns before labels exist. An unusual spike in first-time merchants, strange device reuse, or odd geo-velocity can surface as anomalies. The limitation is false alarms: legitimate unusual behavior is common. The best practice is to treat anomalies as signals for investigation and rapid labeling, then fold those labels into supervised training. This blended approach—classification for decisions, ranking for triage, anomaly detection for discovery—is a realistic blueprint for how problem types work together in production.

What to carry forward

You can classify most ML use cases by the shape of the output and the kind of feedback you have. Classification and regression dominate when labels exist and you need measurable generalization. Ranking changes the game when you choose among many items and must anticipate feedback loops. Clustering and anomaly detection help when labels are missing, but require extra discipline to avoid over-interpreting patterns.

This sets you up perfectly for Data to Models & Deliverables [20 minutes].

Last modified: Tuesday, 17 February 2026, 2:11 PM