求助,关于libsvm的运算结果分类精度 5
请问libsvm分类后每一类具体的结果怎么查看,我现在得出只有总的准确率,在Matlab平台,代码如下file=importdata('Iris.mat');data=f...
请问libsvm 分类后每一类具体的结果怎么查看,我现在得出只有总的准确率,在Matlab平台,代码如下
file=importdata('Iris.mat');
data=file;
features=data(:,1:4);
classlabel=data(:,5);
n = randperm(size(features,1));
train_features=features(n(1:75),:);
train_label=classlabel(n(1:75),:);
test_features=features(n(76:end),:);
test_label=classlabel(n(76:end),:);
[Train_features,PS] = mapminmax(train_features');
Train_features = Train_features';
Test_features = mapminmax('apply',test_features',PS);
Test_features = Test_features';
model = libsvmtrain(train_label,Train_features);
[predict_train_label] = libsvmpredict(train_label,Train_features,model);
[predict_test_label] = libsvmpredict(test_label,Test_features,model);
compare_train = (train_label == predict_train_label);
accuracy_train = sum(compare_train)/size(train_label,1)*100;
fprintf('训练集准确率:%f\n',accuracy_train)
compare_test = (test_label == predict_test_label);
accuracy_test = sum(compare_test)/size(test_label,1)*100;
fprintf('测试集准确率:%f\n',accuracy_test) 展开
file=importdata('Iris.mat');
data=file;
features=data(:,1:4);
classlabel=data(:,5);
n = randperm(size(features,1));
train_features=features(n(1:75),:);
train_label=classlabel(n(1:75),:);
test_features=features(n(76:end),:);
test_label=classlabel(n(76:end),:);
[Train_features,PS] = mapminmax(train_features');
Train_features = Train_features';
Test_features = mapminmax('apply',test_features',PS);
Test_features = Test_features';
model = libsvmtrain(train_label,Train_features);
[predict_train_label] = libsvmpredict(train_label,Train_features,model);
[predict_test_label] = libsvmpredict(test_label,Test_features,model);
compare_train = (train_label == predict_train_label);
accuracy_train = sum(compare_train)/size(train_label,1)*100;
fprintf('训练集准确率:%f\n',accuracy_train)
compare_test = (test_label == predict_test_label);
accuracy_test = sum(compare_test)/size(test_label,1)*100;
fprintf('测试集准确率:%f\n',accuracy_test) 展开
意法半导体(中国)投资有限公司
2023-06-12 广告
2023-06-12 广告
STM32F103C8T6是一款基于ARM Cortex-M3内核的微控制器,具有以下基本参数:1. 工作频率:72MHz2. 外部时钟:最高可达120MHz3. 存储器容量:64K bytes4. 数据总线宽度:32位5. 输入/输出端口...
点击进入详情页
本回答由意法半导体(中国)投资有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询