Closed kaoribundo closed 5 years ago
Hi @kaoribundo. Perhaps I'm not fully understanding the issue. Why would you expect the partial dependence (i.e., yhat
) to match the encoded feature values?
Hello @bgreenwell . Thank you for your reply. And sorry for my poor explanation ...
For example , I used age_range
feature and would like to understand the partial dependence of each category (like 10's , 20's and so on ...)
But I translated this categorical feature as numeric feature by using target based encoding, (using the occurance probability toward the objective feature of each category , like 10's → 0.25, 20's → 0.5)
and fit the xgboost model .
In order to interpret the behaviour of the model on each categorical feature (like 10's and 20's) , I think we should know the yhat of 0.25 , 0.5.
I have few knowledge of interpretable machine learning , so maybe I am saying unreasonable thing ...
Hi @bgreenwell
I solved my problem by using 'pred.grid' arugments , and get the yhat which matched the target encoded categorical feature .
I looked your code and understand that if 'pred.grid' arguments is missing , the 'pred.val' function compensate the pred.grid values. And also when 'cats' arguments is used, the unique values of the feature would be used in pred.grid. https://github.com/bgreenwell/pdp/blob/a7f755ceffd0d2ab5da684869ec1f40f882d2bab/R/pred_grid.R#L25-L27
This seems to work for numeric features , but I could not get the results which I expected. But anyway, I got the expected results by using 'pred.grid' arugments !
Thank you for your time , and I will close this issue.
issue : 'pdp' library is very very useful, but I have a problem in one case.
In order to fit xgboost model, I have translated categorical features to numeric feature by useing Target encoding . Then I used 'partial' function with 'cats' arguments in the feature. I supposed yhat correspond to each target encode value, but the feature value from partial was different. (The original value and partial value did not match. )
This is the example codes when I faced to the problem. Please tell me how to solve this problem.
Thank you for reading this issue.