clear, clc, close all, warning off % global zpi % global epsilon % Main file % Entekhab simulated ya Real dar Par_Ext % taghire parameterha mesle Ic dar do tab Akhar %%%%%% SVM Line 19 :>> SIMPLOT Comment or uncommemnt it global data data=xlsread('lymphoma.xlsx'); global sig_U num_rep=1; % 30 or more Halat=1; % 1 Baraye nemodar khatti accuracy Tekrar ba yek daste parameter moshakhas 2 Baraye ejraye extensive switch Halat case 1 % line plot zpi_r= 1.8; sig_U_r= 0.09; case 2 % plot surface % zpi_r=-2.5:0.5:2.5; % sig_U_r=0.01:0.05:0.5; % zpi_r=-.5:.1:1.5; % sig_U_r=0.03:.01:0.5; zpi_r= 1.5:0.3:2.5; sig_U_r= -0.05:0.03:0.1; end Mod1=zeros(length(zpi_r),length(sig_U_r),num_rep); Mod2=Mod1;Mod3=Mod1; Modm1=zeros(length(zpi_r),length(sig_U_r),1); Modm2=Modm1; Modm3=Modm1; for i=1:num_rep [Mod1(:,:,i),Mod2(:,:,i),Mod3(:,:,i)] = Par_Ext(zpi_r,sig_U_r); % Mod = accuracy, 1 linear 2 poly 3 rbf Modm1(:,:,1)=Modm1(:,:,1)+Mod1(:,:,i); % Modm= Summation Modm2(:,:,1)=Modm2(:,:,1)+Mod2(:,:,i); Modm3(:,:,1)=Modm3(:,:,1)+Mod3(:,:,i); disp(['iter= ' num2str(i)]) end ModM1=Modm1/num_rep; % Mean ModM2=Modm2/num_rep; ModM3=Modm3/num_rep; %% switch Halat case 2 Temp1=reshape(ModM1,[length(zpi_r),length(sig_U_r)]); Temp1(:,length(sig_U_r)+1)=zpi_r'; Temp1(length(zpi_r)+1,:)=[sig_U_r 0]; Temp2=ModM2; Temp2(:,length(sig_U_r)+1)=zpi_r'; Temp2(length(zpi_r)+1,:)=[sig_U_r 0]; Temp3=ModM3; Temp3(:,length(sig_U_r)+1)=zpi_r'; Temp3(length(zpi_r)+1,:)=[sig_U_r 0]; xlswrite('Mixed_Proposed1', Temp1); xlswrite('Mixed_Proposed2', Temp2); xlswrite('Mixed_Proposed3', Temp3); end %% temp_acc1=reshape(Mod1(1,1,:),[1,num_rep]); temp_acc2=reshape(Mod2(1,1,:),[1,num_rep]); temp_acc3=reshape(Mod3(1,1,:),[1,num_rep]); switch Halat case 1 figure() plot(1:num_rep,temp_acc1,'r') xlabel('iteration') ylabel('Accuracy') title('Linear') figure() plot(1:num_rep,temp_acc2,'r') xlabel('iteration') ylabel('Accuracy') title('Polynomial') figure() plot(1:num_rep,temp_acc3,'r') xlabel('iteration') ylabel('Accuracy') title('RBF') case 2 deghat=150; figure() % surf(sig_U_r,zpi_r,ModM1(:,:,1)) smoothen(sig_U_r,zpi_r,ModM1(:,:,1),deghat) xlabel('s_U') ylabel('r') zlabel('Accuracy') title('Mean Accuracy for Linear Kernel') figure() % surf(sig_U_r,zpi_r,ModM2(:,:,1)) smoothen(sig_U_r,zpi_r,ModM2(:,:,1),deghat) xlabel('s_U') ylabel('r') zlabel('Accuracy') title('Mean Accuracy for Polynomial Kernel') figure() % surf(sig_U_r,zpi_r,ModM3(:,:,1)) smoothen(sig_U_r,zpi_r,ModM3(:,:,1),deghat) xlabel('s_U') ylabel('r') zlabel('Accuracy') title('Mean Accuracy for RBF Kernel') end %---------------------------------------------- function [Mod1,Mod2,Mod3] = Par_Ext(zpi_r,sig_U_r) % global sig_U_r % global zpi_r % Mod1=zeros(length(zpi_r),length(sig_U_r)); % Mod2=Mod1; Mod3=Mod1; for j=1:length(zpi_r) zpi=zpi_r(j); for k=1:length(sig_U_r) sig_U=sig_U_r(k); %acc=SimulatedData_ext(zpi,sig_U); acc=RealData_ext(zpi,sig_U); Mod1(j,k)=acc(2,1);Mod2(j,k)=acc(2,3);Mod3(j,k)=acc(2,5); end end end %------------------------------------------------- function Kernel = My_Kernel(A,dim,degree,mu,beta,type,Ap) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here Kernel=zeros(dim,dim); % A=[]; switch type case 'Linear' % Linear Kernel = A*A'; % Kernel = A*Ap(:,1:end-1)'; case 'polynomial' % polynomial for i=1:dim for j=1:dim Kernel(i,j)=(A(i,:)*A(j,:)'+1)^degree; end end case 'RBF' % % RBF for i=1:dim for j=1:dim Kernel(i,j)=exp((-mu*norm(A(i,:)-A(j,:),2)^2)); end end % case 'Tanh' % Tangent hyperbolic for i=1:dim for j=1:dim Kernel(i,j)=tanh(mu*A(i,:)*A(j,:)'+beta); end end end %---------------------------------- function [outputArg1,outputArg2] = Find_E_F(K,V,dim,data,zpi) %UNTITLED Summary of this function goes here % Detailed explanation goes here E=zeros(K,K-1,K-1); F=zeros(K,K-1,K-1); for j=1:K-1 for i=1:K mm=0; for m=1:K if i~=m mm=mm+1; E(i,mm,j)=2*(V(i,j)-V(m,j))'; F(i,mm,j)=2*(V(i,j)^2-V(m,j)^2)'; end end end end % Assigning E_hat and F_hat based on data to their E and F arrays. E_hat=zeros(2*dim,dim,K-1); F_hat=zeros(2*dim,1,K-1); for j=1:K-1 for i=1:dim Ci=data(i,end); E_hat(2*i-1:2*i,i,j)=E(Ci,:,j); F_hat(2*i-1:2*i,1,j)=F(Ci,:,j); end end outputArg1 = E_hat; outputArg2 = F_hat*zpi; end %----------------------------------------- function class = Find_class(f1,f2,dim) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here class=zeros(1,dim); center=[0.5,sqrt(3)/6]; m1=sqrt(3)/3; m2=-sqrt(3)/3; for i=1:dim if f1(i)<=0.5 if f2(i)<=center(2) class(i)=1; elseif (f2(i)-center(2))/(f1(i)-center(1))>=m2 class(i)=1; else class(i)=3; end elseif f1(i)>0.5 if f2(i)<=center(2) class(i)=2; elseif (f2(i)-center(2))/(f1(i)-center(1))<=m1 class(i)=2; else class(i)=3; end end end end %---------------------------------------- function [H,B] = Find_H_B(E_hat,F_hat,Kernel,e1,e2,epsilon,zpi,model) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here sig_U=0.53; switch model case 'Proposed2' % journal paper 2 H= E_hat(:,:,1)*(Kernel+zpi^2*eye(size(Kernel,1)))*E_hat(:,:,1)' + ... E_hat(:,:,2)*(Kernel+zpi^2*eye(size(Kernel,1)))*E_hat(:,:,2)'; B= (zpi*F_hat(:,:,1)+((zpi-1)*sig_U+epsilon)*e2) + (zpi*F_hat(:,:,2)+((zpi-1)*sig_U+epsilon)*e2) ; %B= (F_hat(:,:,1)+epsilon*e2) + (F_hat(:,:,2)+epsilon*e2); case 'Proposed' % journal paper 1 H= E_hat(:,:,1)*(Kernel+eye(size(Kernel,1)))*E_hat(:,:,1)' + ... E_hat(:,:,2)*(Kernel+eye(size(Kernel,1)))*E_hat(:,:,2)'; B= (F_hat(:,:,1)+((u-epsilon)*Pi + u)*e2) + (F_hat(:,:,2)+((u-epsilon)*Pi + u)*e2); %B= (F_hat(:,:,1)+epsilon*e2) + (F_hat(:,:,2)+epsilon*e2); case 'Original' H= E_hat(:,:,1)*(Kernel+e1*e1')*E_hat(:,:,1)' + ... E_hat(:,:,2)*(Kernel+e1*e1')*E_hat(:,:,2)'; B= (F_hat(:,:,1)+epsilon*e2) + (F_hat(:,:,2)+epsilon*e2); end end %------------------------------------------
An Error occurred while handling another error:
yii\web\HeadersAlreadySentException: Headers already sent in on line 0. in /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/Response.php:366
Stack trace:
#0 /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders()
#1 /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/ErrorHandler.php(136): yii\web\Response->send()
#2 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/ErrorHandler.php(135): yii\web\ErrorHandler->renderException()
#3 [internal function]: yii\base\ErrorHandler->handleException()
#4 {main}
Previous exception:
yii\web\HeadersAlreadySentException: Headers already sent in on line 0. in /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/Response.php:366
Stack trace:
#0 /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders()
#1 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/Application.php(656): yii\web\Response->send()
#2 /var/www/html/prof-homepages/vendor/faravaghi/yii2-filemanager/models/Files.php(696): yii\base\Application->end()
#3 /var/www/html/prof-homepages/vendor/faravaghi/yii2-filemanager/controllers/FilesController.php(484): faravaghi\filemanager\models\Files->getFile()
#4 [internal function]: faravaghi\filemanager\controllers\FilesController->actionGetFile()
#5 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#6 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams()
#7 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction()
#8 /var/www/html/prof-homepages/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction()
#9 /var/www/html/prof-homepages/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest()
#10 /var/www/html/prof-homepages/backend/web/index.php(16): yii\base\Application->run()
#11 {main}