# Importance of predictors within an Optimizable GPR model

10 visualizzazioni (ultimi 30 giorni)
lauzof il 6 Set 2023
Commentato: lauzof il 20 Set 2023
Hello everyone,
related with a previous topic I posted (https://it.mathworks.com/matlabcentral/answers/2011417-regression-learner-app-relative-weights-of-variables#answer_1296851?s_tid=prof_contriblnk), I'd like to know if is it possible to find the predictor importance from my model at a global level ? something as shown in the first plot of here https://it.mathworks.com/help/stats/lime.plot.html but not for an individual queryPoint but the whole model
thanks again!
best,
Laura
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Ive J il 11 Set 2023
It's almost always good to look at both local and global levels. In case of lime or SHAP, you can calculate on a random subset of your training dataset, and take the average SHAP (this can be quite computationally heavy for GPR though).
numSample = 1000; % for 1000 randomly selected observations
shap_idx = randsample(1:height(x_train), numSample);
shap_train = x_train(shap_idx, 1:end-1); % x_train is a table, and target variable is the last col
explainer = shapley(yourGPRmodel, shap_train, UseParallel=true); % check other arguments, e.g. if categorical features are there
shap = zeros(size(shap_train, 1), size(shap_train, 2));
for k = 1:size(shap_train, 1)
explainer = fit(explainer, shap_train(k, :), UseParallel=true);
shap(k, :) = explainer.ShapleyValues.ShapleyValue;
end
shap_mean_abs = mean(abs(shap), 1)';
On a global level you can try
doc plotPartialDependence
Also check ICE plots for the above, for individual observations.
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
lauzof il 20 Set 2023
Thanks a lot, Ive

Accedi per commentare.

### Categorie

Scopri di più su Dimensionality Reduction and Feature Extraction in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by