Pick the family by the answer you want back, a label means a classifier, a number means a regressor, groups with no labels means a clusterer, and a normal or weird flag means an anomaly detector. Then start with the simplest model in that family, naiveBayes or randomForest, ridge, kmeans, or isolationForest, and only move to a heavier one when your own test results ask for it. The tables below put all 18 side by side.
The 1 Minute Version
| You have | You want | Start with | Then try |
| Short text with labels | A category | naiveBayes | logisticRegression, then dnn |
| Table columns with labels | A category | randomForest | adaBoost, or tree to explain |
| Under 100 labeled rows | A category | knn | naiveBayes |
| Table columns with a number | A number | ridge | gradientBoost |
| Comparable past cases | A number | knnRegressor | gradientBoost |
| No labels, known group count | Groups | kmeans | gaussianMixture |
| No labels, unknown group count | Groups plus noise | dbscan | kmeans once you know the count |
| Many columns of normal behavior | A weird flag | isolationForest | localOutlierFactor |
| 1 metric over time | A weird flag | robustZScore | isolationForest |
The class names in code style are the ones used by ML Prediction Engine, the free open source tool the step by step guides in this topic are built on. "Rows to start" in the tables below means the point where the model becomes useful, not where it stops improving.
Classifiers: You Want a Label
| Model | Best for | Pros | Cons | Rows to start |
K Nearest Neighbors
knn | Small data, answers that must be explained by similar cases | Nothing to train, easy to explain, follows odd shaped groups | Slows as rows grow, hurt by junk columns since every column counts equally | 20 to 30 per label |
Naive Bayes
naiveBayes | Short text: spam, intent, topic | No parameters, instant training, handles many labels | Ignores word order, weak when features depend on each other | 20 to 30 per label |
Logistic Regression
logisticRegression | Text past a few hundred rows, yes or no on numeric columns | Stable, fast, strong baseline | Can not learn combinations or curves | 50 per label |
Decision Tree
tree | Rule like decisions that need a readable reason | Reads like a flowchart, no scaling, handles combinations | Memorizes when deep, jumpy, poor on text | 30 per label |
Random Forest
randomForest | Table data with mixed columns, the default choice | Accurate on defaults, ignores junk columns, tolerates some bad labels | Not readable, larger model, weak on rare labels | A few hundred |
AdaBoost
adaBoost | Yes or no on clean table data | Strong from simple pieces, resists memorizing | Thrown off by wrong labels and outliers | A few hundred |
Deep Neural Network
dnn | Large text sets, patterns the others miss | Learns combinations and curves, keeps improving with data | Needs many rows, slow to train, 4 parameters, no explanation | 1,000 or more |
Regressors: You Want a Number
| Model | Best for | Pros | Cons | Rows to start |
Ridge Regression
ridge | Proportional relationships, the baseline for everything | Instant, readable weights, follows a trend past the data | Straight lines only, pulled by outliers in the label | 50, or 10 per column |
KNN Regressor
knnRegressor | Estimating from comparable past cases | Follows any shape, realistic answers, easy to explain | Never predicts beyond what it has seen, slows as rows grow | 100 across the range |
Support Vector Regression
svr | Smooth curves on small, noisy data | Ignores small errors, steady, smooth output | Label must be scaled, slow past about 10,000 rows | 100 |
Gradient Boost
gradientBoost | Table data, usually the most accurate | Learns curves and combinations, no scaling, ignores junk columns | Flat beyond the training range, can fit noise with too many rounds | A few hundred |
MLP Regressor
mlpRegressor | Complex shapes with a lot of data | Any curve, smooth output | Needs many rows and a scaled label, slow, differs between runs | 1,000 or more |
Clusterers: You Have No Labels and Want Groups
| Model | Best for | Pros | Cons | Rows to start |
K-Means
kmeans | A set number of groups, text themes, segments | Fast, simple, works on text | Always returns k groups, round groups only, every column counts equally | A few dozen per group |
DBSCAN
dbscan | Unknown number of groups, duplicates, outsiders | Finds the count itself, any shape, answers -1 for noise | 1 radius for all groups, clusters on every prediction so keep the data small | 50 |
Gaussian Mixture
gaussianMixture | Overlapping groups of different sizes on numeric columns | Each group has its own size and shape | Needs more rows, not for text or many columns | 50 per group |
Anomaly Detectors: You Want a Normal or Weird Flag
| Model | Best for | Pros | Cons | Rows to start |
Isolation Forest
isolationForest | Many columns at once, the general pick | No scaling, fast on large data, needs no bad examples | Misses context anomalies, always flags a set share, no reason given | A few hundred normal rows |
Local Outlier Factor
localOutlierFactor | Values wrong for their context, several kinds of normal | Judges each row against its own kind | Slows on large data, weak with many columns, always flags a set share | 40 to 60 per kind of case |
Robust Z Score
robustZScore | Watching 1 metric with alerts people can read | Explainable in a sentence, tolerates dirty history, can flag nothing | Checks columns separately, fails on metrics that rarely change, numbers only | 50 readings |
Default Parameters
Every model works with an empty parameter object, these are the defaults it falls back to and the one setting most worth changing first.
| Class | Defaults | Change this first |
knn | {"k": 5} | k, try 3, 9, and 15 |
naiveBayes | {} | Nothing to change |
logisticRegression | {"c": 1, "maxIter": 200} | c, try 0.1 and 10 |
tree | {"maxHeight": 10} | maxHeight, go lower, 3 to 5 |
randomForest | {"estimators": 100, "treeMaxHeight": 0} | Usually nothing, 0 means no depth limit |
adaBoost | {"estimators": 100, "rate": 1} | rate 0.5 with estimators 200 |
dnn | {"layers": [128, 64], "epochs": 300, "learningRate": 0.001, "alpha": 0.0001} | layers, smaller for less data |
ridge | {"alpha": 1} | alpha, try 0.1 and 10 |
knnRegressor | {"k": 5} | k, try 3 and 10 |
svr | {"c": 1, "epsilon": 0.1} | c, raise to 10 or 100 if predictions are flat |
gradientBoost | {"estimators": 100, "rate": 0.1, "treeMaxHeight": 3} | rate 0.05 with estimators 200 |
mlpRegressor | {"layers": [128, 64], "epochs": 300, "learningRate": 0.001, "alpha": 0.0001} | layers, then alpha |
kmeans | {"k": 4} | k, by reading the groups |
dbscan | {"radius": 0.5, "minDensity": 5}, plus "scale": false for raw units | radius, by how much comes back as noise |
gaussianMixture | {"k": 4} | k, by describing each group |
isolationForest | {"estimators": 100, "contamination": 0.1} | contamination, down to your real alert rate |
localOutlierFactor | {"k": 20, "contamination": 0.1} | contamination, then k |
robustZScore | {"threshold": 3.5} | threshold, 5 for fewer alerts |
Who Scales the Numbers
Some models compare raw sizes and some do not, and getting this wrong is the most common reason a model that should work does not. Text is never a concern, it is always converted to word scores on 1 scale. For numeric input:
| Situation | Classes | What to do |
| Scale does not matter | tree, randomForest, adaBoost, gradientBoost, isolationForest, robustZScore, naiveBayes | Send raw values |
| Scaled for you by the engine | logisticRegression, dnn, ridge, knnRegressor, svr, mlpRegressor, localOutlierFactor, knn, kmeans, dbscan | Send raw values |
| Raw units on request | dbscan | Add "scale": false when the radius is a real distance, like points on a map |
| Helps, but matters less | gaussianMixture | Bring columns into roughly comparable ranges when one is far larger than another |
| Scale the label too | svr, mlpRegressor | Divide the label into a small range and multiply the prediction back |
Rules That Apply to All 18
- Judge a model only on rows it did not train on. Every model looks good on rows it has already seen.
- Rows beat model choice. Going from 50 rows to 500 real, balanced rows usually helps more than any switch between models.
- Keep labels balanced. A label with 10 times the rows of another wins most close calls.
- Add your mistakes back. A real input the model got wrong, with the right label, is the most valuable row you can add.
- Get a baseline first. Train the simple model in the family before the heavy one, so you know what the heavy one has to beat.
- If 3 different models all miss the same rows, the answer is not in your columns, and no fourth model will find it.
Key Takeaway
The answer shape picks the family and the size of your data picks the model. Small data wants knn, naiveBayes, ridge, or robustZScore. A few hundred rows open up randomForest and gradientBoost, which are the strongest general choices. The neural models, dnn and mlpRegressor, are for 1,000 rows or more and only after a simpler model has set the bar.