当前位置:网站首页>【ELM分类】基于核极限学习机和极限学习机实现UCI数据集分类附matlab代码
【ELM分类】基于核极限学习机和极限学习机实现UCI数据集分类附matlab代码
2022-07-28 01:30:00 【matlab_dingdang】
1 内容介绍
极限学习机(extreme learning machine,ELM)作为一种新兴的机器学习方法,已经成为了一个热门的研究方向。 ELM 随机确定单隐含层网络的输入权值和隐含层节点偏置,通过简单计算即可解析得到输出权值,不仅加快了学习速度,而且具有很好的泛化能力。 核函数 ELM 将核函数引入到极限学习机理论中,可以得到最小平方优化解,解决了
ELM 算法随机初始化问题,对模型学习参数具有较好的鲁棒性,具有更稳定的、更好的泛化性能。



2 仿真代码
clcclear allDataSetName = 'waveform'; %以matlab格式存储的数据集名称TrainSamplesPartio = 0.5; %每类训练样本所占比例C = 100; %正则化因子DataSet = load(DataSetName, '-mat'); %加载文件到程序DataSet = getfield(DataSet, DataSetName);%获取文件中数据KindIdx = DataSet(:,1); %获取类别号,数据第1列为类别编号KindCount = length(unique(KindIdx)); %总类别数SortedDataSet = sortrows(DataSet, 1); %按类标号排列数据,按类标号从小到大重排数据,方便后面随机抽取数据clear DataSetEachKindCount = zeros(1,KindCount); %每类数据个数for i=1:KindCountEachKindCount(i) = sum(sum( i == SortedDataSet(:,1))); %第i类数据个数endTrainData = [];TestData = [];%将所有类别的训练数据和测试数据放一个矩阵里TrainTemp = [];TestTemp = [];for i=1:KindCountif i==1TempIdx1(1:TrainSamCountEachKind(i),1) = i; %标示训练数据类标号TempIdx2(1:size(TestDataEachKind{i},1),1) = i; %标示测试数据类标号TrainData = [TempIdx1 TrainDataEachKind{1,i}]; %第一列为类标号TestData = [TempIdx2 TestDataEachKind{1,i}];TempIdx1 = []; %此处要清空类标号,否则可能产生错误类标号,因为每类数据个数可能不同TempIdx2 = [];TrainTemp = TrainData;TestTemp = TestData;elseTempIdx1(1:TrainSamCountEachKind(i),1) = i;TempIdx2(1:size(TestDataEachKind{i},1),1) = i;TrainData = [TrainTemp;[TempIdx1 TrainDataEachKind{1,i}]];TestData = [TestTemp;[TempIdx2 TestDataEachKind{1,i}]];TrainTemp = TrainData;TestTemp = TestData;TempIdx1 = [];TempIdx2 = [];endendclear TrainTemp TestTemp TrainDataEachKind TestDataEachKind%统计结果[label_index_actual, label_index_expected, TrainingAccuracy, TestingAccuracy] = elm(TrainData, TestData, 1, KindCount, 'sig');%格式化输出相关信息,可根据自己需要修改fprintf('Run Information:\n')fprintf('+-----------------------------------------------+\n')fprintf('|KindIdx | EachKindCount | EachTrainKindCount |\n');fprintf('+-----------------------------------------------+\n')Msgemat='| %2d |%9d |%11d |\n';for i=1:KindCountfprintf(Msgemat, i, EachKindCount(i), TrainSamCountEachKind(i));fprintf('+-----------------------------------------------+\n')endfprintf('+------------------------------------------------------+\n')figureplot(label_index_actual,'rs')hold onplot( label_index_expected,'bo')xlabel('样本')legend('真实值','测试值')title(['测试准确率=',num2str(TestingAccuracy)])
3 运行结果


4 参考文献
[1]王丽, 兰陟, 杨荣,等. 基于核函数极限学习机和小波包变换的EEG分类方法[J]. 北京生物医学工程, 2018, 37(5):8.
[2]王丽等. "基于核函数极限学习机和小波包变换的EEG分类方法.".
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
边栏推荐
- 小程序毕设作品之微信校园浴室预约小程序毕业设计成品(2)小程序功能
- 探究flex-basis
- 智能合约安全——selfdestruct攻击
- OBS键盘插件自定义diy
- 【TA-霜狼_may-《百人计划》】图形3.7 移动端TP(D)R架构
- Sqlserver problem solving: replication components are not installed on this server. Please run SQL Server Setup again and select the option to install replication components
- Soft test - database (2) relational model
- Common SQL statement query
- 正则表达式
- MySQL 中的 INSERT 是怎么加锁的?(荣耀典藏版)
猜你喜欢

MySQL是如何利用索引的(荣耀典藏版)

Important arrangements - the follow-up live broadcast of dx12 engine development course will be held at station B

Leetcode hot topic Hot 100 - > 1. Sum of two numbers

Newline required at end of file but not found.

Unity 保存图片到相册以及权限管理

Say yes, I will love you, and I will love you well

【TA-霜狼_may-《百人计划》】图形3.7 移动端TP(D)R架构

Learn this trick and never be afraid to let the code collapse by mistake

Manual installation of Dlib Library

Compile and use Qwt in qt|vs2017
随机推荐
[tutorial of using idea] shortcut key of idea
Mysql Explain 详解(荣耀典藏版)
Pytorch optimizer settings
第二季度邮件安全报告:邮件攻击暴增4倍,利用知名品牌获取信任
OBS键盘插件自定义diy
[Yugong series] July 2022 go teaching course 019 - for circular structure
数字赋能 创新未来:海丝埃睿迪亮相第五届数字中国建设峰会
程序里随处可见的interface,真的有用吗?真的用对了吗?
【HCIP】BGP 基础
Important arrangements - the follow-up live broadcast of dx12 engine development course will be held at station B
Wechat campus bathroom reservation applet graduation design finished product (2) applet function
Three core issues of concurrent programming (glory Collection Edition)
With elephant & nbsp; Eplato created by swap, analysis of the high premium behind it
cn+dt
Special network technology virtual host PHP version setting
CeresDAO:全球首个基于DAO赋能Web3.0的去中心化数字资产管理协议
How to put app on the app store?
【自我成长网站收集】
Understand the "next big trend" in the encryption industry - ventures Dao
初识C语言 -- 操作符和关键字,#define,指针