# Feature importance of fully connected neurons network (Relative Importance)

7 visualizzazioni (ultimi 30 giorni)
sherwan Najm il 10 Feb 2022
Risposto: Vatsal il 20 Ott 2023
Dear MathWorks Community,
I have a fully connected neurons network, and I have the initial and result in weights. The network has five inputs and three neurons with one output; the bias is (+1). I kindly ask if it is possible to calculate the feature importance (Relative Importance) of the inputs; let us Call them (A, B, C, D, and E). The initial and the resulting weights are below. It is appreciated if the number of inputs and neurons be as parametric to be changed.
////initial weights
0.96000000 -0.78000000 -0.76000000 -0.42000000 -0.48000000 0.52000000
0.52000000 0.94000000 0.74000000 0.22000000 -0.06000000 0.36000000 -0.50000000
-0.90000000 -0.66000000 -0.32000000 0.02000000 0.88000000 0.10000000 -0.68000000 0.38000000
////result weights
30.28172977 -8.19280617 2.59276326 -7.30170239 -1.79862626 0.39566791
99.09610372 -3.98615863 41.15997085 24.65729897 383.02673592 41.82976873 -177.63460075
-31.48093460 -0.05714430 -0.03576784 0.01020878 -0.05643959 0.00721399 -0.13373771 31.67916521
Sherwan
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

Vatsal il 20 Ott 2023
Hi,
I understand that you want to calculate the feature importance (Relative Importance) of the inputs. Attached below is a general approach to calculate the relative feature importance:
% Define the initial and result weights
initial_weights = [0.96, -0.78, -0.76, -0.42, -0.48, 0.52;
0.52, 0.94, 0.74, 0.22, -0.06, 0.36;
-0.5, -0.9, -0.66, -0.32, 0.02, 0.88];
result_weights = [30.28, -8.19, 2.59, -7.30, -1.79, 0.39;
99.09, -3.98, 41.15, 24.65, 383.02, 41.82;
-177.63, -31.48, -0.05, -0.03, 0.01, -0.05];
delta_weights = abs(result_weights - initial_weights);
sum_changes = sum(delta_weights(:,1:num_inputs), 1);
total_sum_changes = sum(sum_changes);
% Calculate the relative importance
relative_importance = sum_changes / total_sum_changes;
I hope this helps!
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Neural Simulation 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