-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRUN_Cross_Validation.m
103 lines (76 loc) · 2.81 KB
/
RUN_Cross_Validation.m
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
%--------------------------------------------------------------------------
%
% Author:
%Junjun Zhang and Minzhu Xie
%
% Purpose:
% Perform drug-target interaction prediction in a cross-validation setting
% to estimate prediction performance of various prediction methods.
% (DEFAULT: 5 repetitions of 10-fold cross validation)
%
clear % clear workspace
clc % clear console screen
diary off; diary on; % to save console output
%--------------------------------------------------------------------------
%*************************%
%* Adjustable Parameters *%
%*************************%
% The location of the folder that contains the data
path='data\';
% the different datasets
datasets={'e','ic','gpcr','nr'};
% CLASSIFIER -------------------------------
classifier='iPALMDLMF';
% ------------------------------------------
% Parameters and Options -------------------
%WKNKN
use_WKNKN = 0; % 1=yes, 0=no
K = 5; % number of K nearest known neighbors
eta = 0.7; % decay rate (also used by WNN in RLS-WNN)
%weight matrix W (used by WGRMF and CMF)
if strcmp(classifier,'wgrmf') || strcmp(classifier,'cmf')
use_W_matrix = 1;
else
use_W_matrix = 0;
end
% ------------------------------------------
% CROSS VALIDATION SETTING -----------------
cv_setting = 'cv_d'; % DRUG PREDICTION CASE
% cv_setting = 'cv_t'; % TARGET PREDICTION CASE
% ------------------------------------------
% CROSS VALIDATION PARAMETERS --------------
m = 5; % number of n-fold experiments (repetitions)
% m = 1;
n = 10; % the 'n' in "n-fold experiment"
% n = 5;
% ------------------------------------------
%warning off % to be used when many unnecessary warnings are being produced
%--------------------------------------------------------------------------
% Terminology:
% Y = Interaction matrix
% Sd = Drug similarity matrix
% St = Target similarity matrix
disp('==============================================================');
fprintf('\nClassifier Used: %s',classifier);
switch cv_setting
case 'cv_d', fprintf('\nCV Setting Used: CV_d - New Drug\n');
case 'cv_t', fprintf('\nCV Setting Used: CV_t - New Target\n');
end
if use_WKNKN
fprintf('\nusing WKNKN: K=%i, eta=%g\n',K,eta);
end
fprintf('\n');
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
for ds=[4 3 2 1]
disp('--------------------------------------------------------------');
fprintf('\nData Set: %s\n', datasets{ds});
% LOAD DATA
[Y,Sd,St,Did,Tid]=getdata(path,datasets{ds});
% PREDICT (+ print evaluation metrics)
crossValidation(Y',Sd,St,classifier,cv_setting,m,n,use_WKNKN,K,eta,use_W_matrix);
disp('--------------------------------------------------------------');
diary off; diary on;
end
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
disp('==============================================================');
diary off;