フィルターのクリア

How to calculate Shapley values of the constructed classification model from the whole dataset, not a query point ?

9 ビュー (過去 30 日間)
Wennie
Wennie 2022 年 9 月 27 日
回答済み: Drew 2023 年 4 月 19 日
I have created a ensemble machine learning model using the AdaBoost and Tree method. And I want to calculate the average shapley value of the most important features of the whole dataset, not a query point. Here's my code:
blackbox=fitensemble(P_train_smote,P_train_label,'AdaBoostM1',100,'Tree')
queryPoint=P_train_smote(1:end,:)
explainer = shapley(blackbox,P_train_smote,"QueryPoint",queryPoint,'Method','conditional-kernel');
explainer.ShapleyValues
ShapleyValues=table(explainer.ShapleyValues)
plot(explainer)
I got the wrong code like:
Error using shapley
'QueryPoint' value is invalid. The input should be row vector.
Is there a way to obtain the whole Shapley values from the whole dataset? Please help me!

回答 (1 件)

Drew
Drew 2023 年 4 月 19 日
The short answer is to loop over the query points, then take the mean(abs(shapley_value)) along the appropriate dimension.
You can see examples of this in other answers:

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by