Databricks Machine Learning Associate Question 614
Single answerYou are developing a machine learning model to predict housing prices. During the data preprocessing step, you applied a log transformation to the target variable (price) to address skewness. After making predictions using the trained model, you observe that the predictions are still in the log-transformed scale. Which of the following steps should you take before calculating evaluation metrics like RMSE or interpreting the predictions?
- A
Directly calculate the evaluation metrics, as the log-transformed scale is consistent with how the model was trained.
- B
Exponentiate the predicted values to revert them to the original scale before calculating evaluation metrics or interpreting them.
- C
Leave the predictions in the log-transformed scale but exponentiate the actual values instead when calculating evaluation metrics.
- D
Apply a linear scaling factor to the predictions to convert them back to the original scale.
Show answer and explanation
Correct answer: B
Explanation
When a log transformation is applied to the target variable during preprocessing, the model predicts values on the log-transformed scale. Before calculating evaluation metrics like RMSE or interpreting the predictions, it is necessary to exponentiate the predictions to revert them to the original scale. This ensures that the predictions are directly comparable to the actual values, allowing for meaningful evaluation and interpretation.
- A. Incorrect.
This is incorrect because evaluation metrics like RMSE need both predictions and actual values to be in the same scale as the original data for meaningful interpretation.
- B. Correct.
This is correct because exponentiating the log-transformed predictions reverts them to the original scale, making them comparable to the actual values for evaluation metrics and interpretation.
- C. Incorrect.
This is incorrect because exponentiating the actual values instead of the predictions would introduce inconsistencies in the evaluation process, as the model was trained in the log-transformed scale.
- D. Incorrect.
This is incorrect because a linear scaling factor does not accurately reverse the log transformation applied to the predictions. Exponentiation is necessary to revert the transformation.