没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
matlab算法,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。 Matlab(Matrix Laboratory)是一种专为数值计算和科学与工程应用而设计的高级编程语言和环境。在算法开发和实现方面,Matlab具有以下一些好处: 1. 丰富的数学和科学函数库:Matlab提供了广泛的数学、信号处理、图像处理、优化、统计等领域的函数库,这些函数库可以帮助开发者快速实现各种复杂的数值计算算法。这些函数库提供了许多常用的算法和工具,可以大大简化算法开发的过程。 2. 易于学习和使用:Matlab具有简单易用的语法和直观的编程环境,使得算法开发者可以更快速地实现和测试他们的算法。Matlab的语法与数学表达式和矩阵操作非常相似,这使得算法的表达更加简洁、清晰。 3. 快速原型开发:Matlab提供了一个交互式的开发环境,可以快速进行算法的原型开发和测试。开发者可以实时查看和修改变量、绘制图形、调试代码等,从而加快了算法的迭代和优化过程。这种快速原型开发的特性使得算法开发者可以更快地验证和修改他们的想法。 4. 可视化和绘图功能:Matlab具有强大的可视化和绘图功能,可以帮助开发者直观地展示和分析算法的结果。开发者可以使用Matlab绘制各种图形、曲线、图像,以及创建动画和交互式界面,从而更好地理解和传达算法的工作原理和效果。 5. 并行计算和加速:Matlab提供了并行计算和加速工具,如并行计算工具箱和GPU计算功能。这些工具可以帮助开发者利用多核处理器和图形处理器(GPU)来加速算法的计算过程,提高算法的性能和效率
资源推荐
资源详情
资源评论
收起资源包目录
使用支持向量数据描述( SVDD )进行异常检测的MATLAB代码。.zip (13个子文件)
SVDD-MATLAB-master
demo_BinaryDataset.m 449B
demo_DimReduPCA.m 960B
demo_BasicSVDD.m 628B
demo_ParameterOptimization.m 1013B
demo_ObservationWeight.m 930B
demo_KernelFunction.m 1KB
Svdd
SvddVisualization.m 18KB
BaseKernel.m 3KB
BinaryDataset.m 8KB
SvddOptimization.m 16KB
BaseSVDD.m 19KB
README.md 9KB
demo_HybridKernelSVDD.m 1KB
共 13 条
- 1
<p align="center">
<img src="http://github-files-qiu.oss-cn-beijing.aliyuncs.com/SVDD-MATLAB/demo_.png">
</p>
<h3 align="center">Support Vector Data Description (SVDD)</h3>
<p align="center">MATLAB Code for abnormal detection using SVDD</p>
<p align="center">Version 2.2, 13-MAY-2022</p>
<p align="center">Email: iqiukp@outlook.com</p>
<div align=center>
[![View Support Vector Data Description (SVDD) on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://ww2.mathworks.cn/matlabcentral/fileexchange/69296-support-vector-data-description-svdd)
<img src="https://img.shields.io/github/v/release/iqiukp/Support-Vector-Data-Description-SVDD?label=version" />
<img src="https://img.shields.io/github/repo-size/iqiukp/Support-Vector-Data-Description-SVDD" />
<img src="https://img.shields.io/github/languages/code-size/iqiukp/Support-Vector-Data-Description-SVDD" />
<img src="https://img.shields.io/github/languages/top/iqiukp/Support-Vector-Data-Description-SVDD" />
<img src="https://img.shields.io/github/stars/iqiukp/Support-Vector-Data-Description-SVDD" />
<img src="https://img.shields.io/github/forks/iqiukp/Support-Vector-Data-Description-SVDD" />
</div>
<hr />
## ⨠MAIN FEATURES
- SVDD model for one-class or binary classification
- Multiple kinds of kernel functions (linear, gaussian, polynomial, sigmoid, laplacian)
- Visualization of decision boundaries for 2D or 3D data
- Parameter optimization using Bayesian optimization, genetic algorithm, and pParticle swarm optimization
- Weighted SVDD model
- Hybrid-kernel SVDD model (K =w1ÃK1+w2ÃK2+...+wnÃKn)
## â ï¸ NOTICES
- This version of this code is not compatible with the versions lower than ***R2016b***.
- The label must be 1 for positive sample or -1 for negative sample.
- Detailed applications please see the provided ***demonstrations***.
- This code is for reference only.
## ð¨ HOW TO USE
### ð A simple SVDD model
Please see the demonstration [`ð demo_BasicSVDD.m`](https://github.com/iqiukp/SVDD-MATLAB/blob/master/demo_BasicSVDD.m) for details.
```MATLAB
% generate dataset
ocdata = BinaryDataset();
ocdata.generate;
[trainData, trainLabel, testData, testLabel] = ocdata.partition;
% set parameter
kernel = BaseKernel('type', 'gaussian', 'gamma', 0.04);
cost = 0.3;
svddParameter = struct('cost', cost,...
'kernelFunc', kernel);
% creat an SVDD object
svdd = BaseSVDD(svddParameter);
% train SVDD model
svdd.train(trainData, trainLabel);
% test SVDD model
results = svdd.test(testData, testLabel);
```
- `BinaryDataset` is designed to validate the svdd model only, you can use your data and please be careful to keep the naming of variables consistent, e.g. `trainData`, `trainLabel`, `testData`, and `testLabel`.
- Specifically, if the data does not have labels, please change the inputs for training or testing to `svdd.train(trainData)` and `results = svdd.test(testData)`.
### ð Parameter Optimization for SVDD model
A class named `SvddOptimization` is defined to optimized the parameters. First define an optimization setting structure, then add it to the svdd parameter structure.The parameter optimization of the polynomial kernel function can only be achieved by using Bayesian optimization.
Please see the demonstration [`ð demo_ParameterOptimization.m`](https://github.com/iqiukp/SVDD-MATLAB/blob/master/demo_ParameterOptimization.m) for details.
```MATLAB
% optimization setting
optimization.method = 'bayes'; %
optimization.maxIteration = 20;
optimization.display = 'on';
% SVDD parameter
svddParameter = struct('cost', cost,...
'kernelFunc', kernel,...
'optimization', optimization);
```
The full properties of optimization are
- `method`: optimization methods, only supported for 'bayes', 'pso', and 'ga'.
- `variableName`: variables that are to be optimized, including 'cost', 'degree', 'offset', and 'gamma'.
- `variableType`: variable type, specified as 'real' (real variable), 'integer' (integer variable).
- `lowerBound`: lower bound of variables.
- `upperBound`: upper bound of variables.
- `maxIteration`: max iterations.
- `points`: size of group or seed.
- `display `: visualization, 'on' or 'off'.
### ð Visualization of SVDD model
A class named `SvddVisualization` is defined to visualize the training and test results. Based on the trained SVDD model, the ROC curve of the training results (only supported for dataset containing both positive and negetive samples) is
```MATLAB
% Visualization
svplot = SvddVisualization();
svplot.ROC(svdd);
```
<p align="center">
<img src="http://github-files-qiu.oss-cn-beijing.aliyuncs.com/SVDD-MATLAB/ROC-3D_.png">
</p>
The decision boundaries (only supported for 2D/3D dataset) are
```MATLAB
% Visualization
svplot = SvddVisualization();
svplot.boundary(svdd);
```
<p align="center">
<img src="http://github-files-qiu.oss-cn-beijing.aliyuncs.com/SVDD-MATLAB/boundary-2D_.png">
</p>
<p align="center">
<img src="https://github-files-qiu.oss-cn-beijing.aliyuncs.com/SVDD-MATLAB/boundary-3D_.png">
</p>
The distance between the test data and the hypersphere is
```MATLAB
svplot.distance(svdd, results);
```
<p align="center">
<img src="http://github-files-qiu.oss-cn-beijing.aliyuncs.com/SVDD-MATLAB/distance-3D_.png">
</p>
### ð Binary Dataset for SVDD model
A class named `BinaryDataset` is defined to generate and partition the 2D or 3D binary dataset.
Please see the demonstration [`ðdemo_BinaryDataset.m`](https://github.com/iqiukp/SVDD-MATLAB/blob/master/demo_BinaryDataset.m) for details.
```MATLAB
ocdata = BinaryDataset();
[data, label] = ocdata.generate;
[trainData, trainLabel, testData, testLabel] = ocdata.partition;
```
The method `generate` is designed to generate dataset. The syntax of `generate` is
```MATLAB
ocdata.generate;
data = ocdata.generate;
[data, label] = ocdata.generate;
```
The method `partition` is designed to partition dataset into training dataset and test dataset. The syntax of `partition` is
```MATLAB
[trainData, trainLabel, testData, testLabel] = ocdata.partition;
```
The full Name-Value Arguments of class `BinaryDataset` are
- `shape`: shape of dataset, 'banana' or 'circle'.
- `dimensionality`: dimensionality of dataset, 2 or 3.
- `number`: number of samples per class, for example: [200, 200].
- `display`: visualization, 'on' or 'off'.
- `noise`: noise added to dataset with range [0, 1]. For example: 0.2.
- `ratio`: ratio of the test set with range (0, 1). For example: 0.3.
### ð Kernel funcions
A class named `BaseKernel` is defined to compute kernel function matrix.
Please see the demonstration [`ðdemo_KernelFunction.m`](https://github.com/iqiukp/SVDD-MATLAB/blob/master/demo_KernelFunction.m) for details.
```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 = BaseKernel('type', 'gaussian', 'gamma', value);
kernel = BaseKernel('type', 'polynomial', 'degree', value);
kernel = BaseKernel('type', 'linear');
kernel = BaseKernel('type', 'sigmoid', 'gamma', value);
kernel = BaseKernel('type', 'laplacian', 'gamma', value);
```
### ð Cross Validation
In this code, two cross-validation methods are supported: 'K-Folds' and 'Holdout'. For example, the cross-validation of 5-Folds is
```MATLAB
svddParameter = struct('cost', cost,...
'kernelFunc', kernel,...
'KFold', 5);
```
For example, the cross-validation of the Holdout method with a ratio of 0.3 is
```MATLAB
svddParameter = struct('cost', cost,...
'kernelFunc', kernel,...
'Holdout', 0.3);
```
### ð Dimensionality reduction using PCA
For example, reducing
资源评论
若明天不见
- 粉丝: 1w+
- 资源: 272
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 检测机项目四工位转盘LABVIEW上位机与西门子PLC通讯操作手册及数据保存至EXCEL指南,检测机项目,四工位转盘 上位机用LABVIEW做的,工控机有2个串口和仪表VISA通讯读取保存数据到EX
- kde-l10n-Irish-4.10.5-2.el7.x64-86.rpm.tar.gz
- 最新电动汽车方案:含代码、原理图与PCB,新能源汽车从业者快速上手宝典,最新电动汽车方案,包含代码,原理图,pcb 新能源汽车从业者的好帮手,快速上手 ,核心关键词:最新电动汽车方案; 代码; 原
- kde-l10n-Italian-4.10.5-2.el7.x64-86.rpm.tar.gz
- kde-l10n-Japanese-4.10.5-2.el7.x64-86.rpm.tar.gz
- 基于FPGA自适应STC算法的可逆图像隐写技术-用于隐秘通信与信息安全传输,基于FPGA的图像隐写可逆信息隐藏 隐秘通信 加密 STC算法 信息安全MATLAB WOW HUGO 本设计利用Veri
- kde-l10n-Kazakh-4.10.5-2.el7.x64-86.rpm.tar.gz
- 三相整流仿真与单相整流仿真中的双闭环PI控制策略及SVPWM与PLL锁相环技术实现电压稳定在700V研究,三相整流仿真,电压外环电流内环双闭环pi控制,svpwm,pll锁相环,整流电压稳定在700v
- kde-l10n-Khmer-4.10.5-2.el7.x64-86.rpm.tar.gz
- kde-l10n-Korean-4.10.5-2.el7.x64-86.rpm.tar.gz
- 基于S7-300 PLC与Wincc组态的手控分拣系统方案与图纸集(附梯形图、接线图、IO分配与组态画面),基于S7-300 PLC和Wincc组态机械手分拣控制系统 带解释的梯形图程序,接线图原理图
- Java毕设项目:基于springboot+maven+mysql实现的时装购物系统服装商城【含源码+数据库+开题报告+答辩PPT+毕业论文】
- kde-l10n-Latvian-4.10.5-2.el7.x64-86.rpm.tar.gz
- 基于S7-300 PLC的滚珠自动分拣控制系统设计:梯形图程序详解与IO分配组态展示,基于S7-300 PLC的滚珠自动分拣控制系统设计直径物分拣 带解释的梯形图程序,接线图原理图图纸,io分配,组态
- kde-l10n-Lithuanian-4.10.5-2.el7.x64-86.rpm.tar.gz
- 海鸥算法SOA优化随机森林RF的预测效果对比:MSE及论文评价指标分析,算法编写简洁附带注释,数据可替换应用,利用海鸥算法SOA优化随机森林RF,然后和没有优化的原始RF进行预测效果的对比,利用预测集
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功