QuestionQ60

VerifiedModel Development

A machine learning engineer wants to build a Spark ML linear regression model that predicts a hotel room’s price. They use the Spark DataFrame train_df to train the model.

The Spark DataFrame train_df has the following schema:

Question Image

The machine learning engineer provides the following code block:

Question Image

Which of the following modifications must the machine learning engineer make to complete the task?

Explanation

Spark ML LinearRegression consumes a single vector-valued feature column. The separate numeric columns stars, year_updated, and beds must therefore be combined into one vector column, such as by using VectorAssembler, and that vector column must be supplied as featuresCol.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!