Databricks Certified Machine Learning Associate Practice Questions

Databricks Certified Machine Learning Associate exam preparation

Databricks Certified Machine Learning Associate practice questions in English: 170 questions with explanations. The mock exam has 48 questions and 90 minutes.

Databricks Certified Machine Learning Associate free question 6 / 10 · Domain 3: Model Development

A data scientist builds a multiclass model with Spark MLlib (spark.ml) NaiveBayes. The features are continuous values standardized to zero mean and unit variance, so some are negative. If NaiveBayes is kept, which modelType setting is appropriate?

  1. No setting is needed, because the default "gaussian" handles continuous values as they are
  2. Set modelType to "gaussian" and train on the standardized continuous values as they are
  3. Keep the default modelType and set the smoothing parameter to 0 to reduce the effect of negative values
  4. Set modelType to "bernoulli" and train on the standardized continuous values as they are
Show the answer and explanation

Answer: B

Why this is correct
spark.ml NaiveBayes offers Multinomial, Complement, Bernoulli and Gaussian models, selected with the optional modelType parameter, and "multinomial" is the default. Multinomial, Complement and Bernoulli are typically used for document classification, with term frequencies or zero-or-one indicators as features, and the documentation says feature values for Multinomial and Bernoulli models must be non-negative. Standardized features with negative values need the Gaussian model, so modelType has to be set to "gaussian" explicitly.

Why the other options are wrong
"No setting is needed, because the default "gaussian" handles continuous values as they are" … The default modelType is "multinomial", not "gaussian". Training on features that include negative values without changing it breaks the non-negative requirement of the multinomial model.
"Keep the default modelType and set the smoothing parameter to 0 to reduce the effect of negative values" … The smoothing parameter is the strength of additive smoothing, with a default of 1.0, and it does not make negative features acceptable. With the default multinomial model the non-negative requirement stays.
"Set modelType to "bernoulli" and train on the standardized continuous values as they are" … The Bernoulli model uses a zero-or-one indicator of whether a term appears in a document. The documentation requires non-negative feature values for Multinomial and Bernoulli models, so standardized values with negatives cannot be used as they are.

Key point
Naive Bayes needs only one pass over the training data to compute the conditional distribution of the features for each label. For document classification with a multinomial model, the input feature vectors should usually be sparse vectors.

Go to the Databricks Certified Machine Learning Associate practice app (10 free questions; purchase unlocks all questions)

See the full practice set