Algorithm 1 CNN-based Feature Selection. |
-
1:
procedure CNNFeatureSelection(trained_cnn, f)
-
2:
Create a new model to output the activations of the last convolutional layer
-
3:
Compute the activations for the testing data X
-
4:
Set the desired number of features n
-
5:
Find the indices of the features with the highest mean activations
-
6:
and save the output in top_feature_indices variable
-
7:
Initialize an empty list as top_feature_names
-
8:
Initialize a counter variable counter = 0
-
9:
for each index in top_feature_indices do
-
10:
if index < length(feature_names) then
-
11:
if counter < n then
-
12:
top_feature_names ← f[index]
-
13:
counter←counter + 1
-
14:
else
-
15:
continue
-
16:
return top_feature_names
|