Add:
@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:
RegressionObjective. They can both use sklearn's mean_squared_log_error, so they'll throw an exception for negative input.AutoRegressionSearch.search to throw an exception if the objective is MSLE/RMSLE and the input y target contains any negative valuesAutoSearchBase._evaluate gives a pipeline a nan score if the objective is MSLE/RMSLE and any of the model predictions are negativeAutoSearchBase._evaluate tries to use the objective to score the pipeline. If exceptions are generated, the pipeline gets a nan objective score.@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!
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 valueswhen its provided with input containing a negative value.I propose the following:
RegressionObjective. They can both use sklearn'smean_squared_log_error, so they'll throw an exception for negative input.AutoRegressionSearch.searchto throw an exception if the objective is MSLE/RMSLE and the inputytarget contains any negative valuesAutoSearchBase._evaluategives a pipeline ananscore if the objective is MSLE/RMSLE and any of the model predictions are negativeAutoSearchBase._evaluatetries to use the objective to score the pipeline. If exceptions are generated, the pipeline gets ananobjective score.@ctduffy @gsheni does this sound good to you?
Also, this is exactly the sort of check which could use our new
DataCheckAPI 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 aDataCheckonce #709 is done. @angela97lin , would you mind filing that?