Databricks Machine Learning · Topic 2 of 6
AutoML for Model and Feature Selection
Databricks ML Associate: how AutoML prepares data, selects columns, tries several algorithms, ranks trials in MLflow and gives you editable notebooks.
- 5 min
- AutoML supports classification, regression and forecasting, from the UI or the Python API.
- Default split is 60/20/20 train, validation, test; classification splits are stratified.
- Every trial is an MLflow run with a generated notebook; the best trial and data exploration notebooks are imported automatically.
What it is
Databricks AutoML takes a dataset and a target column and automatically prepares the data, trains and tunes several algorithms, and ranks the results. It supports classification, regression and forecasting through a low-code UI or a Python API.
It is a "glass box" tool. Every trial is an MLflow run with a generated notebook containing its code, so you can read, rerun and change what AutoML did instead of trusting a black box.
How it works
What AutoML does for you
| Step | What happens |
|---|---|
| Split | By default a random 60% train, 20% validation, 20% test split (stratified for classification); a chronological split if you pick a time column |
| Impute | By default AutoML picks an imputation method from each column's type and content; you can override it per column |
| Semantic type detection | Best effort guesses, for example date strings treated as timestamps and numeric strings as numbers |
| Sample | If the data is too big for one worker's memory, AutoML samples it (stratified for classification) |
| Train and tune | Runs many trials across algorithms, with hyperparameter tuning, distributed across the cluster |
| Rank | Logs every trial to an MLflow experiment and sorts them by the chosen evaluation metric |
How AutoML helps model selection
AutoML tries several algorithm families rather than one. For classification these include decision trees, random forests, logistic regression, XGBoost and LightGBM; for regression, linear regression with stochastic gradient descent replaces logistic regression; forecasting uses Prophet and Auto-ARIMA.
Each trial is scored on the validation split with the primary metric you choose, so you compare algorithms on equal terms. The best trial is the one with the best value of that metric, and its model is logged in MLflow ready to register.
from databricks import automl
summary = automl.classify(
dataset=train_df, target_col="churned",
primary_metric="f1", timeout_minutes=30)
print(summary.best_trial.model_path)
How AutoML helps feature selection
AutoML does not hide feature choices. It supports feature selection in three ways:
- Column selection: clear the Include box in the UI or pass exclude_cols in the API to drop ID columns, leaky columns or noise. All columns are included by default, and the target column cannot be excluded.
- Data exploration notebook: a generated notebook profiles each column (types, missing values, distributions), so you can spot weak or problem features before trusting the results.
- Feature importance: the trial notebooks have a feature importance section using SHAP values. It is off by default because it is memory intensive; set shap_enabled to True and rerun the notebook.
AutoML can also join features from existing feature tables to the input dataset, so curated features are part of the search.
Advantages for the development process
| Advantage | Why it matters |
|---|---|
| Fast baseline | A strong starting model in minutes, before any hand tuning |
| Generated, editable notebooks | Best trial and data exploration notebooks are imported into the workspace; other trials' notebooks are stored as MLflow artifacts to import when needed |
| Full MLflow tracking | Parameters, metrics and models for every trial are logged automatically |
| Less boilerplate | Splitting, imputation and tuning code is written for you |
| Transparency | You see exactly which preprocessing and hyperparameters produced each score |
| Accessible | Analysts with little ML experience can produce a model, and experts can refine the code |
Note that from Databricks Runtime 18.0 ML, AutoML is no longer a built-in library and needs the databricks-automl-runtime package. AutoML runs on dedicated (single user) compute, not on standard access mode compute.
How the exam asks about this
- "A team wants a quick baseline and the code behind it to modify later." Use AutoML, then edit the generated best trial notebook.
- "An ID column is leaking the label in AutoML results." Exclude the column (Include box or exclude_cols) and rerun.
- "Which artifact helps you inspect distributions and missing values before modeling?" The data exploration notebook AutoML generates.
What to remember for the exam
- AutoML supports classification, regression and forecasting, from the UI or the Python API.
- Default split is 60/20/20 train, validation, test; classification splits are stratified.
- Every trial is an MLflow run with a generated notebook; the best trial and data exploration notebooks are imported automatically.
- Feature selection support: exclude_cols, the data exploration notebook, and SHAP feature importance (off by default).
- Trials are ranked by the primary metric you choose on the validation data.
- AutoML gives a baseline; you still review, refine and register the model yourself.
AutoML is not a black box and it does not deploy anything. It produces ranked MLflow runs and notebooks; registering, promoting and serving the model are separate steps.
Common mistakes
Calling AutoML a black box. The defining advantage is the glass box notebooks. If an option says you cannot see or change the code AutoML used, it is wrong.
Expecting AutoML to drop bad features automatically. AutoML includes every column by default. You remove identifiers and leaky columns yourself with the Include box or exclude_cols.
Assuming every trial notebook is in the workspace. For classification and regression only the best trial and data exploration notebooks are imported automatically. Notebooks for the other trials are saved as MLflow artifacts and must be imported.
Check yourself
How does AutoML help you choose between algorithms?
It trains and tunes several algorithm families, logs each trial as an MLflow run, and ranks them by your primary metric on the same validation data.
How do you stop AutoML from using a customer ID column?
Clear the column's Include box in the UI or list it in exclude_cols in the Python API; all columns are included by default.
Which two notebooks does AutoML import for a classification experiment?
The best trial notebook, with the code for the top model, and the data exploration notebook, which profiles the input columns.
Topic 2 of 6 in Databricks Machine Learning
Test yourself on Databricks Machine Learning
The full Databricks Machine Learning Associate question bank has 600 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Databricks. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.