↑ ↓ to move, Enter to open, Esc to close

    DBX-MLAMachine Learning Associate

    Switch exam

    Microsoft Azure

    aws Amazon Web Services

    Google Cloud

    ServiceNow

    Databricks

    Cisco

    Salesforce

    All exams and search

    Exams / DBX-MLA / D1 Model Development

    D1.1

    Model Development

    • 3 min read
    • 6 sections
    • 33 questions
    • Free preview
    • Exam domain: Model Development
    You are reading a free preview. The rest of the DBX-MLA course unlocks with an Exam pass or All access.See plans

    AutoML on Databricks

    Item Fact
    Primary metric "The evaluation metric is the primary metric used to score the runs." Default is f1 for classification and r2 for regression.
    Best model "When a run completes, the top row shows the best model based on the primary metric."
    Source code Select View notebook for best model to review and edit the notebook that created the best model. Each trial's notebook is also in the run's Artifacts.
    Early stopping Classification and regression experiments stop when the validation metric no longer improves.

    Metric families: F1, precision, recall, accuracy are classification metrics. R2, MAE, MSE, RMSE are regression metrics.

    Evaluation metrics

    Need Metric
    Maximize detected positives (few false negatives) Recall = TP / (TP + FN)
    Error magnitude of a regression RMSE (lower is better)
    Goodness of fit of a regression R2
    Multiclass accuracy in Spark ML MulticlassClassificationEvaluator(metricName="accuracy").evaluate(df)
    • RMSE of models trained on log(price) must be computed after exponentiating predictions, so both models are compared on the original price scale.
    • Overall cross-validation error is the mean of the fold errors: (10 + 12 + 17) / 3 = 13.
    • Overfitting (high variance): high training accuracy, low test accuracy.

    Splitting and cross-validation

    Fits needed: cross-validation vs train-validation split

    Approach Cost Estimate quality
    Train-validation split 1 fit per combination Depends on one split
    k-fold CV k fits per combination More reliable
    • Number of models = (product of grid sizes) x k. Example: 4 x 3 x 2 = 24 combinations x 5 folds = 120 fits.
    • Time series: keep chronological order and use rolling (forward-chaining) cross-validation; never random splits.
    • Spark: DataFrame.randomSplit([0.8, 0.2], seed) splits randomly into train/test DataFrames.

    Hyperparameter tuning with Hyperopt

    Hyperopt flow with SparkTrials

    • fmin() runs Hyperopt; algo=tpe.suggest (Tree of Parzen Estimators) uses past results; max_evals is the number of settings tried.
    • SparkTrials distributes trials to Spark workers; use it for single-machine libraries such as scikit-learn. For MLlib or Horovod models, do not use SparkTrials (use default Trials).
    • "Because Hyperopt proposes new trials based on past results, there is a trade-off between parallelism and adaptivity."
    • For a fixed max_evals, more parallelism = faster; lower parallelism may give better results.
    • More evaluations (max_evals) raise the chance of a better model.

    Spark ML building blocks

    Transformer vs Estimator

    Concept Meaning
    Transformer transform(): one DataFrame into another (e.g. VectorAssembler, fitted models)
    Estimator fit(): learns from a DataFrame and returns a Model (e.g. StandardScaler, LogisticRegression, LinearRegression)
    Pipeline Chains Transformers and Estimators
    • LinearRegression takes one vector column as featuresCol; build it with VectorAssembler and set labelCol.
    • Linear regression: solved directly when practical, otherwise by iterative optimization (L-BFGS) for many features.
    • Spark ML trees bin continuous features (maxBins), so results can differ from sklearn.
    • Random forest = bagging; gradient boosted trees = boosting. Combining several models = ensemble learning (stacking uses a meta-model).

    Compute and Git

    • Spark ML after Spark SQL ingestion: all-purpose (standard) cluster. SQL warehouses run SQL and Markdown cells only.
    • Single node compute is for small data or non-distributed workloads.
    • Git folders: enter a message and use Commit & Push in the Git dialog.
    • MLflow run: "Start Time" column in the experiment page gives the run date and time.

    Exam traps

    • F1 is NOT a regression metric.
    • Grid + CV: fits = combinations x folds (not just combinations).
    • Log-label models: exponentiate predictions before RMSE; lower RMSE is better.
    • SparkTrials is for single-node training libraries, not for distributed MLlib.
    • Do not confuse Transformer (transform) and Estimator (fit).
    • Time series: random splits leak the future.

    Docs

    The rest of this chapter is part of the DBX-MLA premium course

    Unlock every chapter, all 140 questions and spaced review with All access or a 90-day exam pass. Every Fundamentals exam stays free, and the first chapter of every exam is open.

    Chapters