👨🎓个人主页:研学社的博客
💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
目录
💥1 概述
1. PCA取主成份95%,共172个。文件:pca.fig
2. kmeans聚类,从1到20。
3. kmeans聚类结果分析。
1. 如果有分类样本数目少于50个,则这种聚类方案被否决。
2. 对每种分类方案,计算平均的 90%样本半径/全体样本半径 的值。 文件:kmeans_stat.fig
最后选取聚类数目为3
4. 基于聚类3进行svdd。
1. 训练svdd。利用drug_1441文件(估计是药典库)。训练所使用的拒绝率参数从0.2到0.6。
训练的细节:
1. 利用设定的拒绝率,指定模型中,优化项的松弛因子。
(松弛度越小,会将比较外围的点排除在模型训练中)
2. svdd中的sigma的范围,通过工具包的range根据数据直接计算而得。
3. sigma选择过程中,从简单的到复杂的。并对模型进行交叉验证。
如果交叉验证得到的拒绝率过高(根据分布检验),说明模型产生过拟合。那么停止选择。
如果从一开始就过拟合,那么对应拒绝率的模型会被直接否决。
检验代码:
nrx = size(x,1); % 数据个数
sigma_thr = 2;
err_thr = fracrej + sigma_thr*sqrt(fracrej*(1-fracrej)/nrx);
最后得到的模型,对应的训练拒绝率分别为 0.3, 0.4, 0.5, 0.6
2. 测试svdd。利用drug_pos文件和outlier文件
测试方式:对每个训练的模型,计算ROC和AUC。
ROC是outlier接受率和target接受率的曲线。
文件分别是
svdd-3-0.3.fig, svdd-3-0.4.fig,svdd-3-0.5.fig,svdd-3-0.6.fig
AUC是ROC曲线的积分。我们只计算从0.05到0.5的积分。因为对outlier接受率不能太高。
得到的AUC分别是 0.5631, 0.5499, 0.5551, 0.5587
因此选择0.3训练拒绝率对应的模型。
相应的,模型阈值可以调整,以便于在实际使用中,使用一个比较适合的预测拒绝率。
📚2 运行结果
由于结果图比较多,这里仅展现部分。
部分代码:
% generate normal classification problem: train data:
a = gendatb([30 30]);
% make the second class the target class and change the labels:
a = oc_set(a,'1');
% only use target class:
a = target_class(a);
% generate test data:
b = oc_set(gendatb(200),'1');
% first show a 2D plot:
figure(1); clf; hold on; H = [0;0];
h = scatterd(a);
V = axis; axis(1.5*V);
% train the individual data descriptions and plot them
% the error on the target class:
fracrej = 0.2;
% train the nndd:
w1 = nndd(a,fracrej);
% and plot the decision boundary:
h = plotc(w1,'k-');
H(1) = h(1);
% second, train the svdd:
w2 = svdd(a,fracrej,5);
% and also plot this:
h = plotc(w2,'r--');
H(2) = h(1);
legend(H,'NNdd','SVDD');
axis equal;
axis image;
% second show the ROC curves:
figure(2); clf;hold on; H=[0;0];
% the ROC for the Nearest Neighbor method:
e1 = dd_roc(b,w1);
% plot the ROC curve:
h = plotroc(e1,'k-'); H(1) = h(1);
% the area under the ROC curve:
auc_nn = dd_auc(e1)
% and the f_1 performance:
f1_nn = b*w1*dd_f1
% the ROC for the SVDD:
e2 = dd_roc(b,w2);
% also plot this:
h = plotroc(e2,'r--'); H(2) = h(1);
% and compute the area under the ROC:
auc_svdd = dd_auc(e2)
% and the f1 measure:
f1_svdd = b*w2*dd_f1;
legend(H,'NNdd','SVDD');
🎉3 参考文献
部分理论来源于网络,如有侵权请联系删除。
[1]胡桂香,李宁,邢艳肖.基于KMM与超像素的SAR海面暗斑分割算法[J].国外电子测量技术,2016,35(06):101-108.DOI:10.19652/j.cnki.femt.2016.06.024.
[2]田慧,刘维滨.基于单分类算法SVDD的柴油机故障预测研究[J].中国水运(下半月),2022,22(09):70-72.