-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyKernel.m
More file actions
44 lines (37 loc) · 865 Bytes
/
myKernel.m
File metadata and controls
44 lines (37 loc) · 865 Bytes
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
function [ out ] = myKernel(x,lambda)
if lambda == 2015
out = x * x';
else if lambda == 2016
out = x * x';
out = out .^ 2;
else if lambda == 2017
out = x*x';
out = out .^4;
else if lambda == 2018
out = 1+x*x';
out = out .^2;
else if lambda == 2019
out = 1+x*x';
out = out .^4;
else if lambda==2020
m=size(x,1);
out=zeros(m);
for i=1:m
for j=i+1:m
out(i,j)=x(i,:)*x(j,:)'/(norm(x(i,:))*norm(x(j,:))+eps);
out(j,i)=out(i,j);
end
end
else
tmp=EuDist2(x,[],0);
delta=lambda*max(tmp(:));
out = exp(-tmp./delta);
end
end
end
end
end
end
maximum=max(out(:));
out = out ./maximum;
end