bug in plotPartialDependence for categorical predictors ?

1 view (last 30 days)
Hello
I am using regression tree with two predictors : one real and one categorical (10 categories from 0 to 9). When I plot the partial dependence for the categorical predictors, the estimates are given for 20 categories instead of 10 (at 0, 0.5, 1 etc. till 9 then NaN). I know that we can not use "query point" option to change these values but I do not understand how a partial dependence can be computed for a category that does not exist (as 0.5 or 1.5). Is it a bug ? My matlab version is 2018a and my script is
T=fitrtree(MODEL(train,2:npred),MODEL(train,1),'CategoricalPredictors',2);
plotPartialDependence(T,2);
[X,Y]=extract_fig2D(gcf); % this code simply extracts graphical values from a 2D plot
>> X
X =
Columns 1 through 14
0 0.5000 1.0000 1.5000 2.0000 2.5000 3.0000 3.5000 4.0000 4.5000 5.0000 5.5000 6.0000 6.5000
Columns 15 through 20
7.0000 7.5000 8.0000 8.5000 9.0000 NaN
Thank you in advance
Vincent M.

Answers (0)

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!