Choosing a Model in ML Prediction Engine
Decision One: What Kind of Answer?
Every practical prediction job wants one of four answer shapes, and each shape has its own model category.
| You want | Category | Example |
|---|---|---|
| A category label | Classifier | "Is this ticket billing, technical, or sales?" |
| A number | Regressor | "What will this lead be worth?" |
| Natural groups, no labels | Clusterer | "What themes are in this feedback?" |
| A normal-or-weird flag | Anomaly detector | "Does today's traffic look wrong?" |
Classifiers and regressors learn from labeled rows, examples where you supply the right answer. Clusterers and anomaly detectors train on inputs alone, which makes them the right tools when labels are the thing you wish you had. Every category accepts text or numeric inputs: text runs through tf-idf automatically, numeric takes lists of numbers, and the engine prepares each kind on its own.
The Classifiers
K-Nearest Neighbors (knn) predicts by finding the most similar training rows and voting. Simple, fast to train, easy to reason about, and a great first classifier. Its one knob, k, is how many neighbors vote.
Naive Bayes (naiveBayes) is the classic text workhorse, quick on thousands of rows and a strong spam and intent baseline with zero parameters to think about. It picks the right variant itself, Multinomial for text and Gaussian for numbers.
Decision Tree (tree) learns readable if-then splits, and maxHeight controls how deep it may grow. Random Forest (randomForest) trains many varied trees and lets them vote, one of the best default answers for messy tabular data, tuned by estimators and treeMaxHeight. AdaBoost (adaBoost) builds its ensemble the boosting way, each round focusing on the rows the previous rounds found hard.
Logistic Regression (logisticRegression) is the sturdy linear baseline, fast, stable, and strong on text, with c controlling regularization. Neural network (dnn) is a multi-layer perceptron for patterns the simpler classes miss, shaped by layers, epochs, learningRate, and alpha, and it rewards larger datasets.
The Regressors
Ridge (ridge) is the regularized linear regressor, the right first pick when the relationship is roughly proportional, like lead score from engagement counts. KNN regressor (knnRegressor) averages the nearest examples, which handles local patterns linear models smooth over. Support Vector Regression (svr) fits curves with a tolerance band, tuned by c and epsilon. Gradient Boost (gradientBoost) is the ensemble heavyweight for tabular prediction, usually the accuracy leader once you have a few hundred rows. MLP regressor (mlpRegressor) is the neural option for numeric targets with genuinely nonlinear shape.
The Clusterers
K-Means (kmeans) divides data into the k groups you ask for, the go-to for "sort my feedback into 5 themes." Gaussian Mixture (gaussianMixture) also takes k but fits soft, overlapping groups, better when categories blend into each other. DBSCAN (dbscan) discovers the number of groups itself from density, using radius and minDensity, and answers -1 for points that belong to no group, which makes it the clusterer that can also say "this is noise." DBSCAN is special mechanically too: it clusters each prediction against its reference dataset on the spot, so its dataset is always live.
The Anomaly Detectors
Train these on normal data only, ordinary days, legitimate transactions, healthy metrics, so anything different stands out. Isolation Forest (isolationForest) is the general-purpose pick, strong in many dimensions at once. Local Outlier Factor (localOutlierFactor) compares each point's neighborhood density, which catches points that are only strange relative to their local context. Robust Z-Score (robustZScore) is the transparent statistical option for numeric data, flagging values far from the median with a threshold you set. All three answer 1 for anomaly and 0 for normal, a clean flag your alerting can act on, and the contamination parameter on the first two tells the model roughly how rare anomalies should be.
Decision Two: A Short Playbook
- Text classification: start with
naiveBayes, move tologisticRegressionordnnas rows accumulate. - Tabular classification: start with
randomForest, tryknnwhen you want explainable "similar cases" behavior. - Numeric prediction: start with
ridge, move togradientBoostfor accuracy on real-world messiness. - Grouping:
kmeanswhen you know how many groups you want,dbscanwhen you want the data to tell you. - Anomaly flags:
isolationForestfirst,robustZScorewhen you want a rule you can explain in one sentence.
Start simple, look at real predictions in the test box, and upgrade the class only when the results ask for it. Because the dataset is the source of truth, trading classes costs one click and one retrain, the rows stay put. Parameters are set per step as JSON in the admin, with inline help for every class, and the dataset and training guide covers the data side of accuracy, which is where most of the wins live anyway.
Pick the answer shape first: classifier for labels, regressor for numbers, clusterer for unlabeled groups, anomaly detector for normal-or-weird flags. Then start with the simple class in that category, naiveBayes, ridge, kmeans, or isolationForest, and upgrade with one click when your test results ask for more, the dataset follows you.