Classification prediction | Matlab implements multi-input classification prediction based on LFDA-SVM local Fisher discriminant data dimensionality reduction combined with support vector machine
Table of contents
Effect list
basic introduction
The two-class and multi-class modeling of LFDA-SVM based on local Fisher discriminant data dimensionality reduction is used to create two-class and multi-class models with multiple feature inputs and single output.
The comments in the program are detailed and can be used by directly replacing the data.
The programming language is matlab.
The program can produce classification effect diagrams, dimensionality reduction display diagrams, and confusion matrix diagrams.
If you want, just message me privately.
PS: The following renderings are the renderings of test data. The main purpose is to show the results that can be produced by running the program. The specific prediction effect is subject to the specific data of the individual.
programming
- Complete source code and data download private message blogger reply** Matlab implements multi-input classification prediction based on LFDA-SVM local Fisher discriminant data dimensionality reduction combined with support vector machine**.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
%% 清空环境变量
clc;
clear;
warning off
close all
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
%% 添加路径
addpath("Toolbox\")
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
%% 读取数据
res = xlsread('数据集.xlsx');
%% 性能评价
error1 = sum((T_sim1' == T_train)) / M * 100 ;
error2 = sum((T_sim2' == T_test )) / N * 100 ;
%-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
%% 绘图
figure
plot(1: M, T_train, 'r-*', 1: M, T_sim1, 'b-o', 'LineWidth', 1)
legend('真实值', '预测值')
xlabel('预测样本')
ylabel('预测结果')
string = {
'训练集预测结果对比'; ['准确率=' num2str(error1) '%']};
title(string)
grid
figure
plot(1: N, T_test, 'r-*', 1: N, T_sim2, 'b-o', 'LineWidth', 1)
legend('真实值', '预测值')
xlabel('预测样本')
ylabel('预测结果')
string = {
'测试集预测结果对比'; ['准确率=' num2str(error2) '%']};
title(string)
grid
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
%% 混淆矩阵
if flag_conusion == 1
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';
end
References
[1] https://download.csdn.net/download/kjm13182345320/87899283?spm=1001.2014.3001.5503
[2] https://download.csdn.net/download/kjm13182345320/87899230?spm=1001.2014.3001.5503