-
Notifications
You must be signed in to change notification settings - Fork 2
/
Example2.asv
53 lines (41 loc) · 2.17 KB
/
Example2.asv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
% Example 2: Feature selection of saved model
%
% In this Example, feature selection using class-activation maps (CAMs) is executed.
% It is assumed that Example 1 has been run before running this Example.
% Running Example 1 will save model files in Models/Run.. folder and also the
% data file either Out1.mat (if norm1 is used) or Out2.mat (if norm2 is used).
clear all;
close all hidden;
% Step 1: copy model files in the correct folders
% current directory is DeepInsight3D_pkg
unix(['cp Models/Run1/Stage1/model.mat .']);
unix(['cp Models/Run1/Stage1/0.32*.mat DeepResults']);
% 1. Set up parameters by changing Parameter.m file, otherwise leave it with default values.
% 2. Provide the path of dataset in Parameter.m file by chaning the "Data_path" variable.
DSETnum = 1; %This means the stored data in your defined path is dataset1.mat
% dataset(DSETnum)
Parm = Parameters(DSETnum); % Define parameters for DeepInsight3D and CNN
% open file DeepInsight3D_Results.txt for saving the outputs
fid2 = fopen('DeepInsight3D_Results.txt','a+');
% Set CAM Threshold
Parm.Threshold=0.25;
display('Feature selection begins');
[Genes,Genes_compressed,G]= func_FS_class_basedCAM(Parm); % class-based CAM values
%[Genes,Genes_compressed,G]= func_FeatureSelection_CAM(Parm); % sample based CAM (same as DeepFeature paper)
%[Genes,Genes_compressed,G]= func_FeatureSelection_avgCAM(Parm);% using average CAM values across all samples
G
Glen=length(Genes);
Glen_comp = length(Genes_compressed);
fprintf(fid2,'Threshold: %6.2f\n',Parm.Threshold);
fprintf('#Genes = %d; #Genes_compressed = %d\n',Glen,Glen_comp);
fprintf(fid2,'#Genes = %d; #Genes_compressed = %d\n',Glen,Glen_comp);
display('Feature selection ends');
fprintf('Stage %d Ends\n',Parm.Stage);
fprintf(fid2,'Stage %d Ends\n\n',Parm.Stage);
% Define the folder where the model files and figures to be stored.
% By default Parm.FileRun = 'Run1' and Parm.Stage=1 (change as required)
% Then execute the following commands.
% Save model files
func_SaveModels(Parm); % model files will be stored in ~/DeepInsight3D/Models/Run1/Stage1/ (if DSETnum=1)
% Save all figures
func_SaveFigs(Parm); % all figures will be stored in ~/DeepInsight3D_pkg/FIGS/Run1/Stage1/