nerdexam
Amazon

MLA-C01 · Question #222

An ML engineer is building a logistic regression model to predict customer churn for subscription services. The ML engineer is using a dataset that contains two string variables: location and…

The correct answer is B. Apply one-hot encoding to location. Apply ordinal encoding to job_seniority_level. One-hot encoding is appropriate for a categorical variable with a small number of distinct values like location, avoiding any artificial ordering. Ordinal encoding fits job_seniority_level because the values have a natural order, allowing the logistic regression model to…

Data Preparation for Machine Learning

Question

An ML engineer is building a logistic regression model to predict customer churn for subscription services. The ML engineer is using a dataset that contains two string variables: location and job_seniority_level. The location variable has 3 distinct values, and the job_seniority_level variable has over 10 distinct values. The ML engineer must perform preprocessing on the variables. Which solution will meet this requirement?

Options

  • AApply tokenization to location. Apply ordinal encoding to job_seniority_level.
  • BApply one-hot encoding to location. Apply ordinal encoding to job_seniority_level
  • CApply binning to location. Apply standard scaling to job_seniority_level.
  • DApply one-hot encoding to location. Apply standard scaling to job_seniority_level.

How the community answered

(28 responses)
  • A
    7% (2)
  • B
    75% (21)
  • C
    4% (1)
  • D
    14% (4)

Explanation

One-hot encoding is appropriate for a categorical variable with a small number of distinct values like location, avoiding any artificial ordering. Ordinal encoding fits job_seniority_level because the values have a natural order, allowing the logistic regression model to capture progression effects efficiently without excessive feature expansion.

Topics

#Data Preprocessing#Categorical Encoding#One-Hot Encoding#Ordinal Encoding

Community Discussion

No community discussion yet for this question.

Full MLA-C01 Practice