Evalml: Add metrics: RMSLE/RMSE/MSLE

Created on 28 Apr 2020  路  2Comments  路  Source: alteryx/evalml

Add:

  • root mean squared error
  • root mean squared log error (which happens to be the default xgboost metric)
  • mean squared log error
enhancement good first issue

Most helpful comment

@ctduffy raised a good point in slack this afternoon: any metric which first takes the logarithm (MSLE/RMSLE) is only valid when both the target and the predictions are guaranteed to be non-negative. Note that sklearn's impl will throw ValueError: Mean Squared Logarithmic Error cannot be used when targets contain negative values when its provided with input containing a negative value.

I propose the following:

  • Implement MSLE and RMSLE objectives, as subclasses of RegressionObjective. They can both use sklearn's mean_squared_log_error, so they'll throw an exception for negative input.
  • Make sure the documentation for MSLE and RMSLE explains that those metrics are only well-defined for non-negative input.
  • Update AutoRegressionSearch.search to throw an exception if the objective is MSLE/RMSLE and the input y target contains any negative values
  • Make sure AutoSearchBase._evaluate gives a pipeline a nan score if the objective is MSLE/RMSLE and any of the model predictions are negative

@ctduffy @gsheni does this sound good to you?

Also, this is exactly the sort of check which could use our new DataCheck API in the near future! @angela97lin is still working on #709 which adds the data checks to automl, so rather than dig into that now, my recommendation is that we file a separate issue to track porting the proposal above to use a DataCheck once #709 is done. @angela97lin , would you mind filing that?

All 2 comments

@ctduffy raised a good point in slack this afternoon: any metric which first takes the logarithm (MSLE/RMSLE) is only valid when both the target and the predictions are guaranteed to be non-negative. Note that sklearn's impl will throw ValueError: Mean Squared Logarithmic Error cannot be used when targets contain negative values when its provided with input containing a negative value.

I propose the following:

  • Implement MSLE and RMSLE objectives, as subclasses of RegressionObjective. They can both use sklearn's mean_squared_log_error, so they'll throw an exception for negative input.
  • Make sure the documentation for MSLE and RMSLE explains that those metrics are only well-defined for non-negative input.
  • Update AutoRegressionSearch.search to throw an exception if the objective is MSLE/RMSLE and the input y target contains any negative values
  • Make sure AutoSearchBase._evaluate gives a pipeline a nan score if the objective is MSLE/RMSLE and any of the model predictions are negative

@ctduffy @gsheni does this sound good to you?

Also, this is exactly the sort of check which could use our new DataCheck API in the near future! @angela97lin is still working on #709 which adds the data checks to automl, so rather than dig into that now, my recommendation is that we file a separate issue to track porting the proposal above to use a DataCheck once #709 is done. @angela97lin , would you mind filing that?

Filed #785! I think what @dsherry proposed is good--if we include good documentation stating that valid inputs must be non-negative then it's very reasonable to throw a ValueError!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dsherry picture dsherry  路  4Comments

dsherry picture dsherry  路  4Comments

dsherry picture dsherry  路  3Comments

angela97lin picture angela97lin  路  5Comments

dsherry picture dsherry  路  3Comments