forked from iqiukp/RVM-MATLAB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_hybrid_kernel.m
45 lines (37 loc) · 1.25 KB
/
demo_hybrid_kernel.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
% A demo for RVM model using hybrid kernel function
clc
clear all
close all
addpath(genpath(pwd))
load UCI_data
%{
------------------------------------------------------------------------
Notice:
training samples
x sample data (input, n*d)
n: number of samples
d: number of features
y sample data (ouput, n*1)
n: number of samples
test samples
xt sample data (input, n*d)
n: number of samples
d: number of features
yt sample data (ouput, n*1)
n: number of samples
------------------------------------------------------------------------
%}
% kernel function (default: kernel = kernel_1+kernel_2)
kernel_1 = Kernel('type', 'gauss', 'width', 2);
kernel_2 = Kernel('type', 'sigm', 'gamma', 0.6, 'offset', 0);
% parameter setting
parameter = struct( 'freeBasis', 'on',...
'display', 'on',...
'maxIter', 1000,...
'kernel', [kernel_1, kernel_2],...
'weight', [1, 1]);
% RVM model training, testing, and visualization
rvm = RVM(parameter);
rvm.train(x, y);
rvm.test(xt, yt);
rvm.draw