-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathalg_rls_wnn.m
59 lines (47 loc) · 1.82 KB
/
alg_rls_wnn.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
function y3=alg_rls_wnn(Y,Sd,St,cv_setting,nr_fold,left_out,use_WKNKN,K,eta,~)
%alg_rls_wnn predicts DTIs based on the algorithm described in the following paper:
% Twan van Laarhoven and Elena Marchiori
% (2013) Predicting Drug-Target Interactions for New Drug Compounds Using a Weighted Nearest Neighbor Profile
%
% Modified from code of:
% Twan van Laarhoven, Sander B. Nabuurs, Elena Marchiori,
% (2011) Gaussian interaction profile kernels for predicting drug–target interaction
% http://cs.ru.nl/~tvanlaarhoven/drugtarget2013/
%
% INPUT:
% Y: interaction matrix
% Sd: pairwise drug similarities matrix
% St: pairwise target similarities matrix
% cv_setting: cross validation setting ('cv_d', 'cv_t' or 'cv_p')
% nr_fold: number of folds in cross validation experiment
% left_out: if cv_setting=='cv_d' --> left_out is 'drug' indices that are left out
% if cv_setting=='cv_t' --> left_out is 'target' indices that are left out
% if cv_setting=='cv_p' --> left_out is 'drug-target pair' indices that are left out
%
% OUTPUT:
% y3: prediction matrix
%--------------------------------------------------------------------
% parameters
alpha = 0.5;
%eta = alg_rls_wnn_parest(Y,Sd,St,cv_setting,nr_fold,left_out);
%--------------------------------------------------------------------
% preprocessing Y
if use_WKNKN
Y = preprocess_WKNKN(Y,Sd,St,K,eta);
else
Y = preprocess_WNN(Y,Sd,St,cv_setting,eta);
end
% GIP
Sd = alpha*Sd + (1-alpha)*getGipKernel(Y);
St = alpha*St + (1-alpha)*getGipKernel(Y');
% RLS_KRON
sigma = 1;
[va,la] = eig(Sd);
[vb,lb] = eig(St);
l = kron(diag(lb)',diag(la));
l = l ./ (l + sigma);
m1 = va' * Y * vb;
m2 = m1 .* l;
y3 = va * m2 * vb';
%fprintf('eta=%g\t\t',eta);
end