Skip to content

Better error message when custom objective specified as string without required args in pipeline score#1941

Merged
freddyaboulton merged 2 commits intomainfrom
1603-improve-error-message-with-custom-objectives-in-pipeline-score
Mar 8, 2021
Merged

Better error message when custom objective specified as string without required args in pipeline score#1941
freddyaboulton merged 2 commits intomainfrom
1603-improve-error-message-with-custom-objectives-in-pipeline-score

Conversation

@freddyaboulton
Copy link
Copy Markdown
Contributor

@freddyaboulton freddyaboulton commented Mar 8, 2021

Pull Request Description

Fixes #1603

pipeline.score(X, y, objectives=['cost benefit matrix'])

image


After creating the pull request: in order to pass the release_notes_updated check you will need to update the "Future Release" section of docs/source/release_notes.rst to include this pull request by adding :pr:123.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 8, 2021

Codecov Report

Merging #1941 (5660e8c) into main (9f1e5a2) will increase coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@            Coverage Diff            @@
##             main    #1941     +/-   ##
=========================================
+ Coverage   100.0%   100.0%   +0.1%     
=========================================
  Files         265      265             
  Lines       21712    21737     +25     
=========================================
+ Hits        21706    21731     +25     
  Misses          6        6             
Impacted Files Coverage Δ
evalml/exceptions/__init__.py 100.0% <ø> (ø)
evalml/exceptions/exceptions.py 100.0% <100.0%> (ø)
evalml/objectives/utils.py 100.0% <100.0%> (ø)
evalml/pipelines/classification_pipeline.py 100.0% <100.0%> (ø)
evalml/pipelines/pipeline_base.py 100.0% <100.0%> (ø)
evalml/pipelines/regression_pipeline.py 100.0% <100.0%> (ø)
.../pipelines/time_series_classification_pipelines.py 100.0% <100.0%> (ø)
...valml/pipelines/time_series_regression_pipeline.py 100.0% <100.0%> (ø)
evalml/tests/objective_tests/test_objectives.py 100.0% <100.0%> (ø)
evalml/tests/pipeline_tests/test_pipelines.py 100.0% <100.0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f1e5a2...5660e8c. Read the comment docs.

Copy link
Copy Markdown
Contributor

@angela97lin angela97lin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🥳 🎉

Left a comment more for my own understanding heh

with pytest.raises(ObjectiveNotFoundError, match="cost benefit is not a valid Objective!"):
pipeline.score(X, y, objectives=["cost benefit", "F1"])

# Verify no exception when objective properly specified
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, what's the behavior if CostBenefitMatrix is not properly instantiated, like CostBenefitMatrix(1)? :o

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd get a TypeError but before the code gets into the score method!

Copy link
Copy Markdown
Contributor

@chukarsten chukarsten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid, good work.

@freddyaboulton freddyaboulton force-pushed the 1603-improve-error-message-with-custom-objectives-in-pipeline-score branch from 3a3a2bc to 5660e8c Compare March 8, 2021 20:03
@freddyaboulton freddyaboulton merged commit 22e158e into main Mar 8, 2021
@freddyaboulton freddyaboulton deleted the 1603-improve-error-message-with-custom-objectives-in-pipeline-score branch March 8, 2021 20:39
@dsherry dsherry mentioned this pull request Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error msg when non-string objective provided without required args

3 participants