-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
ngroup=0
when using xgb_model.pred(pred_interactions=True)
#4276
Comments
Here's necessary files for testing. How to run python SHAP_Analysis_For_Report.py ./model_dense.pkl ./report.dmatrix Expected error [00:02:25] 140190x600 matrix with 76352399 entries loaded from ./data/dense/test.dmatrix
Using 15 samples
Traceback (most recent call last):
File "SHAP_Analysis_For_Report.py", line 91, in <module>
preds = model.predict(dtest, **shap_params)
File "C:\Users\kyoun\Anaconda3\lib\site-packages\xgboost\core.py", line 1306, in predict
preds = preds.reshape(nrow, ngroup, data.num_col() + 1, data.num_col() + 1)
ValueError: cannot reshape array of size 63105 into shape (15,0,601,601) |
I have the same error while I am using the xgboost model which is built using CLI interface. Can some one help |
So the devs are not interested in this problem? |
@kyoungrok0517 Sorry I didn't have a chance to look at this. We have a backlog of issues currently, and are trying to address them when we are able to. A little patience would be appreciated. |
@kyoungrok0517 And I apologize for not giving you any update for more than 2 months. I will look at this issue over this weekend. |
@kyoungrok0517 Quick update: One thing I notice is that your script enables |
Yes please try pred_interactions=True. I’ having a problem with that
setting.
2019년 5월 31일 (금) 오후 6:14, Philip Hyunsu Cho <notifications@github.com>님이 작성:
… @kyoungrok0517 <https://github.com/kyoungrok0517> Quick update: One thing
I notice is that your script enables pred_contribs=True,
approx_contribs=True, pred_interactions=True. Only one of them should
have been enabled, but somehow XGBoost does not produce error for this. I
will see if the problem stays when using pred_interactions=True
exclusively.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4276?email_source=notifications&email_token=AAIAZ7BQ7IUUZA4N4Q5YWSLPYDT75A5CNFSM4G7RMK42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWUVYMY#issuecomment-497638451>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIAZ7DNW2LZ3NVZV3QZLRTPYDT75ANCNFSM4G7RMK4Q>
.
|
@kyoungrok0517 Interesting, so I changed your script from # interactions
shap_params = {
'pred_contribs': True,
'approx_contribs': True,
'pred_interactions': True
}
preds = model.predict(dtest, **shap_params) to # interactions
shap_params = {
'pred_interactions': True,
'approx_contribs': True
}
preds = model.predict(dtest, **shap_params) and I don't get I filed #4522 to fix the issue. Specifically, you will get an error when both |
I see. Thanks for the response!
2019년 5월 31일 (금) 오후 7:26, Philip Hyunsu Cho <notifications@github.com>님이 작성:
… @kyoungrok0517 <https://github.com/kyoungrok0517> Interesting, so I
changed your script from
# interactions
shap_params = {
'pred_contribs': True,
'approx_contribs': True,
'pred_interactions': True
}
preds = model.predict(dtest, **shap_params)
to
# interactions
shap_params = {
'pred_interactions': True,
'approx_contribs': True
}
preds = model.predict(dtest, **shap_params)
and I don't get ngroup = 0 error any more. In about 20 minutes on
C5.9xlarge machine, the modified script completes running.
I filed #4522 <#4522> to fix the
issue. Specifically, you will get an error when both pred_contribs and
pred_interactions are set.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4276?email_source=notifications&email_token=AAIAZ7G7NVXE5PBN6HH4DUDPYD4OXA5CNFSM4G7RMK42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWU3EWA#issuecomment-497660504>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIAZ7EMEZYU6O255FWYFKDPYD4OXANCNFSM4G7RMK4Q>
.
|
Related: shap/shap#464
Problem
I get the following error when I use
pred_interactions=True
to get the feature interaction. The error occurs when reshaping the result array, and I suspect this is because thengroup
(2nd axis of(35255,0,601,601)
) becomes 0, which seems to be an error.The text was updated successfully, but these errors were encountered: