<p align="center">
<img src="https://z3.ax1x.com/2021/10/16/5JSTRU.png">
</p>
<h3 align="center">Relevance Vector Machine (RVM)</h3>
<p align="center">MATLAB code for Relevance Vector Machine</p>
<p align="center">Version 2.1, 31-AUG-2021</p>
<p align="center">Email: iqiukp@outlook.com</p>
<div align=center>
[![View Relevance Vector Machine (RVM) on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/69407-relevance-vector-machine-rvm)
<img src="https://img.shields.io/github/v/release/iqiukp/Relevance-Vector-Machine-RVM?label=version" />
<img src="https://img.shields.io/github/repo-size/iqiukp/Relevance-Vector-Machine-RVM" />
<img src="https://img.shields.io/github/languages/code-size/iqiukp/Relevance-Vector-Machine-RVM" />
<img src="https://img.shields.io/github/languages/top/iqiukp/Relevance-Vector-Machine-RVM" />
<img src="https://img.shields.io/github/stars/iqiukp/Relevance-Vector-Machine-RVM" />
<img src="https://img.shields.io/github/forks/iqiukp/Relevance-Vector-Machine-RVM" />
</div>
<hr />
## Main features
- RVM model for binary classification (RVC) or regression (RVR)
- Multiple kinds of kernel functions (linear, gaussian, polynomial, sigmoid, laplacian)
- Hybrid kernel functions (K =w1×K1+w2×K2+...+wn×Kn)
- Parameter Optimization using Bayesian optimization, Genetic Algorithm, and Particle Swarm Optimization
## Notices
- This version of the code is not compatible with the versions lower than R2016b.
- Detailed applications please see the demonstrations.
- This code is for reference only.
## Citation
```
@article{tipping2001sparse,
title={Sparse Bayesian learning and the relevance vector machine},
author={Tipping, Michael E},
journal={Journal of machine learning research},
volume={1},
number={Jun},
pages={211--244},
year={2001}
}
```
```
@article{qiu2021soft,
title={Soft sensor development based on kernel dynamic time warping and a relevant vector machine for unequal-length batch processes},
author={Qiu, Kepeng and Wang, Jianlin and Wang, Rutong and Guo, Yongqi and Zhao, Liqiang},
journal={Expert Systems with Applications},
volume={182},
pages={115223},
year={2021},
publisher={Elsevier}
}
```
## How to use
### 01. Classification using RVM (RVC)
A demo for classification using RVM
```MATLAB
clc
clear all
close all
addpath(genpath(pwd))
% use fisheriris dataset
load fisheriris
inds = ~strcmp(species, 'setosa');
data_ = meas(inds, 3:4);
label_ = species(inds);
cvIndices = crossvalind('HoldOut', length(data_), 0.3);
trainData = data_(cvIndices, :);
trainLabel = label_(cvIndices, :);
testData = data_(~cvIndices, :);
testLabel = label_(~cvIndices, :);
% kernel function
kernel = Kernel('type', 'gaussian', 'gamma', 0.2);
% parameter
parameter = struct( 'display', 'on',...
'type', 'RVC',...
'kernelFunc', kernel);
rvm = BaseRVM(parameter);
% RVM model training, testing, and visualization
rvm.train(trainData, trainLabel);
results = rvm.test(testData, testLabel);
rvm.draw(results)
```
results:
```MATLAB
*** RVM model (classification) train finished ***
running time = 0.1604 seconds
iterations = 20
number of samples = 70
number of RVs = 2
ratio of RVs = 2.8571%
accuracy = 94.2857%
*** RVM model (classification) test finished ***
running time = 0.0197 seconds
number of samples = 30
accuracy = 96.6667%
```
<p align="center">
<img src="https://z3.ax1x.com/2021/10/16/5JSzi6.png">
<img src="https://z3.ax1x.com/2021/10/16/5JpSJK.png">
</p>
### 02. Regression using RVM (RVR)
A demo for regression using RVM
```MATLAB
clc
clear all
close all
addpath(genpath(pwd))
% sinc funciton
load sinc_data
trainData = x;
trainLabel = y;
testData = xt;
testLabel = yt;
% kernel function
kernel = Kernel('type', 'gaussian', 'gamma', 0.1);
% parameter
parameter = struct( 'display', 'on',...
'type', 'RVR',...
'kernelFunc', kernel);
rvm = BaseRVM(parameter);
% RVM model training, testing, and visualization
rvm.train(trainData, trainLabel);
results = rvm.test(testData, testLabel);
rvm.draw(results)
```
results:
```MATLAB
*** RVM model (regression) train finished ***
running time = 0.1757 seconds
iterations = 76
number of samples = 100
number of RVs = 6
ratio of RVs = 6.0000%
RMSE = 0.1260
R2 = 0.8821
MAE = 0.0999
*** RVM model (regression) test finished ***
running time = 0.0026 seconds
number of samples = 50
RMSE = 0.1424
R2 = 0.8553
MAE = 0.1106
```
<p align="center">
<img src="https://z3.ax1x.com/2021/10/16/5JpPQe.png">
</p>
### 03. Kernel funcions
A class named ***Kernel*** is defined to compute kernel function matrix.
```MATLAB
%{
type -
linear : k(x,y) = x'*y
polynomial : k(x,y) = (γ*x'*y+c)^d
gaussian : k(x,y) = exp(-γ*||x-y||^2)
sigmoid : k(x,y) = tanh(γ*x'*y+c)
laplacian : k(x,y) = exp(-γ*||x-y||)
degree - d
offset - c
gamma - γ
%}
kernel = Kernel('type', 'gaussian', 'gamma', value);
kernel = Kernel('type', 'polynomial', 'degree', value);
kernel = Kernel('type', 'linear');
kernel = Kernel('type', 'sigmoid', 'gamma', value);
kernel = Kernel('type', 'laplacian', 'gamma', value);
```
For example, compute the kernel matrix between **X** and **Y**
```MATLAB
X = rand(5, 2);
Y = rand(3, 2);
kernel = Kernel('type', 'gaussian', 'gamma', 2);
kernelMatrix = kernel.computeMatrix(X, Y);
>> kernelMatrix
kernelMatrix =
0.5684 0.5607 0.4007
0.4651 0.8383 0.5091
0.8392 0.7116 0.9834
0.4731 0.8816 0.8052
0.5034 0.9807 0.7274
```
### 04. Hybrid kernel
A demo for regression using RVM with hybrid_kernel (K =w1×K1+w2×K2+...+wn×Kn)
```MATLAB
clc
clear all
close all
addpath(genpath(pwd))
% sinc funciton
load sinc_data
trainData = x;
trainLabel = y;
testData = xt;
testLabel = yt;
% kernel function
kernel_1 = Kernel('type', 'gaussian', 'gamma', 0.3);
kernel_2 = Kernel('type', 'polynomial', 'degree', 2);
kernelWeight = [0.5, 0.5];
% parameter
parameter = struct( 'display', 'on',...
'type', 'RVR',...
'kernelFunc', [kernel_1, kernel_2],...
'kernelWeight', kernelWeight);
rvm = BaseRVM(parameter);
% RVM model training, testing, and visualization
rvm.train(trainData, trainLabel);
results = rvm.test(testData, testLabel);
rvm.draw(results)
```
### 05. Parameter Optimization for single-kernel-RVM
A demo for RVM model with Parameter Optimization
```MATLAB
clc
clear all
close all
addpath(genpath(pwd))
% use fisheriris dataset
load fisheriris
inds = ~strcmp(species, 'setosa');
data_ = meas(inds, 3:4);
label_ = species(inds);
cvIndices = crossvalind('HoldOut', length(data_), 0.3);
trainData = data_(cvIndices, :);
trainLabel = label_(cvIndices, :);
testData = data_(~cvIndices, :);
testLabel = label_(~cvIndices, :);
% kernel function
kernel = Kernel('type', 'gaussian', 'gamma', 5);
% parameter optimization
opt.method = 'bayes'; % bayes, ga, pso
opt.display = 'on';
opt.iteration = 20;
% parameter
parameter = struct( 'display', 'on',...
'type', 'RVC',...
'kernelFunc', kernel,...
'optimization', opt);
rvm = BaseRVM(parameter);
% RVM model training, testing, and visualization
rvm.train(trainData, trainLabel);
results = rvm.test(trainData, trainLabel);
rvm.draw(results)
```
results:
```MATLAB
*** RVM model (classification) train finished ***
running time = 13.3356 seconds
iterations = 88
number of samples = 70
number of RVs = 4
ratio of RVs
没有合适的资源?快使用搜索试试~ 我知道了~
Matlab实现RVM-Adaboost时间序列预测(完整源码和数据)
共45个文件
m:28个
png:7个
mat:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 66 浏览量
2024-07-07
13:34:15
上传
评论
收藏 4.85MB ZIP 举报
温馨提示
1.Matlab实现RVM-Adaboost时间序列预测,风电功率预测(完整源码和数据)。单输入单输出时间序列预测。 2.excel数据,方便替换,运行环境matlab2023b及以上。 3.程序语言为matlab。 4.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 5.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。 6.作者介绍:某大厂资深算法工程师,从事Matlab、Python算法仿真工作8年;擅长智能优化算法、神经网络预测、信号处理、元胞自动机等多种领域的算法仿真实验,更多仿真源码、数据集定制私信+。
资源推荐
资源详情
资源评论
收起资源包目录
时间序列预测:RVM_Adaboost.zip (45个子文件)
calc_error.m 916B
RVM_Adaboost.mat 22KB
RVM_Adaboost.m 5KB
3.png 30KB
1.png 100KB
6.png 30KB
RVM
demo_hybrid_kernel.m 730B
demo_optimization.m 950B
RvmModel
RvmOptimizationOption.m 11KB
Kernel.m 3KB
RvmOption.m 8KB
BaseRVM.m 9KB
RvmOptimization.m 8KB
SB2_Release_200
SB2_ControlSettings.m 4KB
SB2_Diagnostic.m 4KB
SB2_Manual.pdf 130KB
SB2_UserOptions.m 6KB
SB2_FullStatistics.m 6KB
SB2_PosteriorMode.m 6KB
SB2_Likelihoods.m 2KB
Readme.txt 3KB
SB2_FormatTime.m 2KB
SB2_Sigmoid.m 1KB
licence.txt 15KB
SB2_Initialisation.m 7KB
SparseBayes.m 24KB
SB2_ParameterSettings.m 3KB
SB2_PreProcessBasis.m 2KB
SparseBayesDemo.m 9KB
data
sinc_data.mat 3KB
UCI_data.mat 6KB
custom_option.m 1KB
demo_hybrid_kernel_optimization.m 796B
demo_RVR.m 562B
demo_RVC.m 787B
RVM.mat 22KB
README.md 12KB
demo_kernel_function.m 661B
风电场预测.xlsx 4.32MB
5.png 59KB
4.png 79KB
data_process.m 174B
7.png 55KB
2.png 63KB
true.mat 3KB
共 45 条
- 1
资源评论
机器学习之心
- 粉丝: 2w+
- 资源: 1031
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功