confusion matrix RBF_mlp_knn

  • habib1418
    了解作者
  • matlab
    开发工具
  • 8.5KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 5 积分
    下载积分
  • 0
    下载次数
  • 2022-06-29 23:07
    上传日期
confusion_matrix_mlp -confusion_matrix_knn -confusion_matrix_RBF
confusion_matrix_knn_mlp_fbf.rar
  • confusion_matrix_knn_mlp_fbf
  • confusion_matrix_knn.m
    2.1KB
  • confusion_matrix_RBF.m
    1.5KB
  • confusion_matrix_mlp.m
    2.4KB
  • brCan_data-1.mat
    5.9KB
内容介绍
%confusion_matrix_mlp clear all; clc; load('brCan_data-1.mat'); data=brCan_data; data=data'; data(1,:)=[]; for i=1:699 if data(10,i)==2 data(10,i)=1; end if data(10,i)==4 data(10,i)=2; end end %% normalize for i=1:9 x(i,:)=data(i,:)/max(abs(data(i,:)));%normalize end for i=1:9 m(i)=mean(data(i,:));%miyangin end for j=1:9 for i=1:240 v(j,i)=(data(j,i)-m(j)).^2;%variance giri end end for i=1:9 mv(i)=sqrt(mean(v(i,:)));%miyangine variance end for j=1:9 for i=1:699 xw(j,i)=(data(j,i)-m(j))/mv(j);%sefid sazi x_trainw=data(:,1:240); x_testw=data(:,241:699); end end x=x_testw; t=x_testw(10,:); % two class %% trainFcn = 'trainlm'; % Levenberg-Marquardt hiddenLayerSize = [40 25] ; net=newff(x,t,hiddenLayerSize,{'logsig','logsig'}); net.input.processFcns = {'removeconstantrows','mapminmax'}; net.output.processFcns = {'removeconstantrows','mapminmax'}; net.divideFcn = 'dividerand'; % Divide data randomly net.divideMode = 'sample'; % Divide up every sample net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100; net.performFcn = 'mse'; % Mean squared error net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ... 'plotregression', 'plotfit'}; [net,tr] = train(net,x,t); y = net(x); e = gsubtract(t,y); performance = perform(net,t,y) trainTargets = t .* tr.trainMask{1}; valTargets = t .* tr.valMask{1}; testTargets = t .* tr.testMask{1}; trainPerformance = perform(net,trainTargets,y) valPerformance = perform(net,valTargets,y) testPerformance = perform(net,testTargets,y) % Plots %figure, plotperform(tr) %figure, plottrainstate(tr) %figure, plotfit(net,x,t) % figure, plotregression(t,y) %figure, ploterrhist(e) if (false) genFunction(net,'myNeuralNetworkFunction'); y = myNeuralNetworkFunction(x); end if (false) genFunction(net,'myNeuralNetworkFunction','MatrixOnly','yes'); y = myNeuralNetworkFunction(x); end if (false) gensim(net); end dif=zeros(2,2); k=0; netclass=net(x_trainw); for i=1:240 if round(netclass(i))==x_trainw(10,i) k=k+1; end if round(netclass(i))<1 netclass(i)=1; end dif(x_trainw(10,i),round(netclass(i)))=dif(x_trainw(10,i),round(netclass(i)))+1 end CCR=(k/240)*100;
评论
    相关推荐