Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change erroranalysis valueerror caused by invalid model prediction shape to user error #2254

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

imatiach-msft
Copy link
Contributor

Description

Change erroranalysis valueerror caused by invalid model prediction shape to user error.

We are seeing value errors like below:

<class 'ValueError'>
File "/mnt/azureml/cr/j/[guid]/exe/wd/_telemetry/_loggerfactory.py", line 143 in wrapper
return func(*args, **kwargs)
File "create_error_analysis.py", line 71 in main
rai_i.compute()
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/responsibleai/rai_insights/rai_base_insights.py", line 81 in compute
manager.compute()
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/responsibleai/managers/error_analysis_manager.py", line 317 in compute
report = self._analyzer.create_error_report(
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/erroranalysis/analyzer/error_analyzer.py", line 399 in create_error_report
tree = self.compute_error_tree(self.feature_names,
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/erroranalysis/analyzer/error_analyzer.py", line 321 in compute_error_tree
return _compute_error_tree(self,
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/erroranalysis/_internal/surrogate_error_tree.py", line 252 in compute_error_tree
return compute_error_tree_on_dataset(
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/erroranalysis/_internal/surrogate_error_tree.py", line 155 in compute_error_tree_on_dataset
booster, dataset_indexed_df, cat_info = get_surrogate_booster_local(
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/erroranalysis/_internal/surrogate_error_tree.py", line 340 in get_surrogate_booster_local
surrogate = create_surrogate_model(analyzer,
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/erroranalysis/_internal/surrogate_error_tree.py", line 485 in create_surrogate_model
surrogate.fit(dataset_sub_features, diff)
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/lightgbm/sklearn.py", line 895 in fit
super().fit(X, y, sample_weight=sample_weight, init_score=init_score,
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/lightgbm/sklearn.py", line 658 in fit
_X, _y = _LGBMCheckXY(X, y, accept_sparse=True, force_all_finite=False, ensure_min_samples=2)
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/sklearn/utils/validation.py", line 979 in check_X_y
y = _check_y(y, multi_output=multi_output, y_numeric=y_numeric)
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/sklearn/utils/validation.py", line 993 in _check_y
y = column_or_1d(y, warn=True)
File "/azureml-envs/responsibleai/lib/python3.8/site-packages/sklearn/utils/validation.py", line 1038 in column_or_1d
raise ValueError(

These seem to be caused by invalid diff array shape caused by unexpected prediction output from the passed in model. This PR fixes the issue by throwing a better user exception message.

Checklist

  • I have added screenshots above for all UI changes.
  • I have added e2e tests for all UI changes.
  • Documentation was updated if it was needed.

@codecov-commenter
Copy link

codecov-commenter commented Aug 16, 2023

Codecov Report

Merging #2254 (5089a52) into main (5c7a0fa) will decrease coverage by 0.01%.
The diff coverage is 91.66%.

@@            Coverage Diff             @@
##             main    #2254      +/-   ##
==========================================
- Coverage   92.26%   92.26%   -0.01%     
==========================================
  Files         103      103              
  Lines        5160     5169       +9     
==========================================
+ Hits         4761     4769       +8     
- Misses        399      400       +1     
Flag Coverage Δ
unittests 92.26% <91.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...is/erroranalysis/_internal/surrogate_error_tree.py 89.52% <91.66%> (-0.02%) ⬇️

2 similar comments
@imatiach-msft imatiach-msft merged commit ebbae9c into main Aug 16, 2023
103 checks passed
@imatiach-msft imatiach-msft deleted the ilmat/fix-ea-multidim-err branch August 16, 2023 20:01
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.

4 participants