I'm trying to create partial dependence plots for a classification model (XGBClassifier). I was able to get variable importance, but some of the partial dependence plots for those variables are empty. These are the two functions I have tried:
PartialDependenceDisplay.from_estimator(model, X_data, [variable])
plot_partial_dependence(model, X_data, [variable])
where model is my trained model, X_data is the dataset of variables, and variable is the specific trait that the partial dependence plot is not showing up for.
I also see that when I use the `partial_dependence| function to see the values, there are nan values where there should be numbers:
partial_dependence(model_type[0], X, [variable])
which gives me:
(array([[0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357,
0.11820357, 0.11820357, 0.11820357, 0.11820357, 0.11820357]],
dtype=float32),
[array([nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan])])
when it should give me two arrays of non empty, unique numbers. I've tried a bunch of different things, but I can't figure out how to fix this, or where in my code there is an error that causes this problem.