分类预测 | Matlab实现OOA-LSSVM鱼鹰算法优化最小二乘支持向量机多特征分类预测/故障诊断

分类预测 | Matlab实现OOA-LSSVM鱼鹰算法优化最小二乘支持向量机多特征分类预测/故障诊断

目录

    • [分类预测 | Matlab实现OOA-LSSVM鱼鹰算法优化最小二乘支持向量机多特征分类预测/故障诊断](#分类预测 | Matlab实现OOA-LSSVM鱼鹰算法优化最小二乘支持向量机多特征分类预测/故障诊断)

分类效果





基本介绍

分类预测 | Matlab实现OOA-LSSVM鱼鹰算法优化最小二乘支持向量机多特征分类预测/故障诊断;

1.Matlab实现OOA-LSSVM鱼鹰算法优化最小二乘支持向量机多特征分类预测,运行环境Matlab2018b及以上;

2.输入12个特征,输出分4类,可视化展示分类准确率,可在下载区获取数据和程序内容。

3.算法优化LSSVM参数为:sig,gamma。

4.excel数据集,main为主程序,其他为函数文件,无需运行。

注:程序和数据放在一个文件夹。

程序设计

clike 复制代码
%%  清空环境变量
warning off             % 关闭报警信息
close all               % 关闭开启的图窗
clear                   % 清空变量
clc                     % 清空命令行

%%  导入数据
res = xlsread('数据集.xlsx');

%% 数据归一化
[p_train, ps_input] = mapminmax(P_train,0,1);
p_test = mapminmax('apply',P_test,ps_input);
t_train = T_train;
t_test  = T_test;
%%  转置以适应模型
p_train = p_train'; p_test = p_test';
t_train = t_train'; t_test = t_test';
%% LS参数设置
type        = 'c';             % 模型类型 分类
kernel_type = 'RBF_kernel';    % 线性核函数
codefct     = 'code_OneVsOne'; % 一对一编码分类
fun = @getObjValue;  % 目标函数
dim = 2;             % 优化参数个数
ub  = [300, 300];  % 优化参数目标上限
lb  = [1, 1];   % 优化参数目标下限

pop = 8;             % 数量
Max_iteration = 20; % 最大迭代次数   

%% 优化算法
[Best_score,Best_pos, curve] = OOA(pop, Max_iteration, lb, ub, dim, fun); 
c = Best_pos(1);  
g = Best_pos(2);



%% 测试模型
t_sim1 = simlssvm(model,p_train);
t_sim2 = simlssvm(model,p_test); 


%% 性能评价
error1 = sum((T_sim1' == T_train))/M * 100 ;
error2 = sum((T_sim2' == T_test))/N * 100 ;

%% 优化曲线
figure
plot(curve, 'linewidth',1.5);
title('OOA-LSSVM')
xlabel('The number of iterations')
ylabel('Fitness')
grid on;
%%  绘图
figure
plot(1: M, T_train, 'r-*', 1: M, T_sim1, 'b-o', 'LineWidth', 1)
legend('真实值', 'OOA-LSSVM预测值')
xlabel('预测样本')
ylabel('预测结果')
string = {'训练集预测结果对比'; ['准确率=' num2str(error1) '%']};
title(string)
xlim([1, M])
grid

figure
plot(1: N, T_test, 'r-*', 1: N, T_sim2, 'b-o', 'LineWidth', 1)
legend('真实值', 'OOA-LSSVM预测值')
xlabel('预测样本')
ylabel('预测结果')
string = {'测试集预测结果对比'; ['准确率=' num2str(error2) '%']};
title(string)
xlim([1, N])
grid

%%  混淆矩阵
figure
cm = confusionchart(T_train, T_sim1);
cm.Title = 'Confusion Matrix for Train Data';
cm.ColumnSummary = 'column-normalized';
cm.RowSummary = 'row-normalized';
    
figure
cm = confusionchart(T_test, T_sim2);
cm.Title = 'Confusion Matrix for Test Data';
cm.ColumnSummary = 'column-normalized';
cm.RowSummary = 'row-normalized';

参考资料

1\] http://t.csdn.cn/pCWSp \[2\] https://download.csdn.net/download/kjm13182345320/87568090?spm=1001.2014.3001.5501 \[3\] https://blog.csdn.net/kjm13182345320/article/details/129433463?spm=1001.2014.3001.5501

相关推荐
Phoebe鑫22 分钟前
数据结构每日一题day7(顺序表)★★★★★
算法
Suc_zhan2 小时前
实验二 如何将随机森林算法应用于激酶抑制剂分类任务
python·算法·随机森林·机器学习
小学仔2 小时前
leetcode -编辑距离
java·算法·动态规划
AI是这个时代的魔法2 小时前
Using Dyck Path to solve a leetcode puzzle
python·算法·leetcode
愚戏师2 小时前
数据结构与算法分析:树与哈希表(一)
数据结构·算法·链表·深度优先·广度优先·宽度优先
float_六七2 小时前
C++中的搜索算法实现
java·c++·算法
电科_银尘3 小时前
【Matlab】-- 基于MATLAB的飞蛾扑火算法与反向传播算法的混凝土强度预测
开发语言·算法·matlab
wen__xvn4 小时前
Codeforces Round 1014 (Div. 2)2092A - Kamilka and the Sheep c++
开发语言·c++·算法
豆芽8194 小时前
基于 Flask 的图像分类预测案例解读
人工智能·后端·python·深度学习·神经网络·分类·flask
梁下轻语的秋缘4 小时前
每日c/c++题 备战蓝桥杯(全排列问题)
c++·算法·蓝桥杯·深度优先