⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fuzzy23.m

📁 标准svm3.0程序 内有mex优化程序
💻 M
字号:
clear all
close all
load vibrate23;
Sample=a;
[row column]=size(Sample);
value0=Sample(:,column);
standdata=Sample;
rate=[];
x=[];
m=0;
%noise=randn(20,8);
load noise23;
standdata=[Sample;(Sample(:,1:column-1)+noise),value0];
%排序
[value,order]=sort(standdata(:,column));
for i=1:column-1
    datai=standdata(:,i);
    orderi=datai(order);
    standdata(:,i)=orderi;
end

catenu=max(value);
classnu=[];
trainnu=[];
beginloc=[1];
overnu=0;
overnut=0;
overloc=[];
overloct=[];
Samples1=[];
Labels=[];
testS1=[];
testL=[];
for i=1:catenu
  number=length(find(value==i));
  classnu=[classnu,number];
  trainnu=[trainnu,round(number*2/3)];
  overnut=overnut+number;
  beginloc=[beginloc,overnut+1];
  overnu=beginloc(i)+round(number*2/3)-1;
  overloc=[overloc,overnu];
  overloct=[overloct,overnut];
 
  Samples1=[Samples1;standdata(beginloc(i):overloc(i),1:column-1)];
  Labels=[Labels;value(beginloc(i):overloc(i))];
  testS1=[testS1;standdata(overloc(i)+1:overloct(i),1:column-1)];
  testL=[testL;value(overloc(i)+1:overloct(i))];
   
end
[AlphaY1, SVs1, Bias1, Parameters1, nSV1, nLabel1] =LinearSVC(Samples1', Labels');
[ClassRate1, DecisionValue1, Ns1, ConfMatrix1, PreLabels1]= SVMTest(testS1',testL', AlphaY1, SVs1, Bias1,Parameters1, nSV1, nLabel1);
ClassRate1
%figure(1)
xx=-3:0.1:3;
mfparams1 = [log(.25) 0];
mftype = 'sigmf';
y=evalmf(xx,mfparams1,mftype);
plot(xx,y)
hold on
mfparams2= [-log(.25) 0];
yy=evalmf(xx,mfparams2,mftype);
plot(xx,yy)


xx=DecisionValue1;
y=evalmf(xx,mfparams1,mftype);
yy=evalmf(xx,mfparams2,mftype);
plot(xx,y,'* r',xx,yy,'o b')
grid on

[Labels, DecisionValue]= SVMClass(SVs1, AlphaY1, SVs1, Bias1, Parameters1, nSV1, nLabel1);
xx=DecisionValue;
y=evalmf(xx,mfparams1,mftype);
yy=evalmf(xx,mfparams2,mftype);
plot(xx,y,'o r',xx,yy,'o r')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -