Databricks Machine Learning Associate Question 558
Single answerYou are working on a machine learning pipeline in Databricks and want to preprocess your data using a VectorAssembler and then train a RandomForestRegressor. Which of the following statements correctly compares the functionality of these two components?
- A
VectorAssembler is an estimator, while RandomForestRegressor is a transformer.
- B
VectorAssembler is a transformer, while RandomForestRegressor is an estimator.
- C
Both VectorAssembler and RandomForestRegressor are transformers.
- D
Both VectorAssembler and RandomForestRegressor are estimators.
Show answer and explanation
Correct answer: B
Explanation
In Databricks, a key distinction between estimators and transformers is how they operate within a machine learning pipeline. Estimators, such as RandomForestRegressor, require a call to the fit method to generate a model, while transformers, such as VectorAssembler, directly process data to produce a transformed dataset. Understanding this distinction is crucial to correctly assembling and executing machine learning pipelines.
- A. Incorrect.
VectorAssembler is not an estimator. It is a transformer because it converts input columns into a single vector column without requiring a fit stage.
- B. Correct.
Correct. VectorAssembler is a transformer because it processes data directly, while RandomForestRegressor is an estimator because it needs to be fitted to data to produce a model.
- C. Incorrect.
This is incorrect because RandomForestRegressor is not a transformer; it is an estimator that must be trained on data.
- D. Incorrect.
This is incorrect because VectorAssembler is not an estimator; it is a transformer that applies a transformation directly to the data.