Info

This question is closed. Reopen it to edit or answer.

fuzzy

2 views (last 30 days)
Pat
Pat on 15 Sep 2011
Closed: Sam Chak on 15 Apr 2025
I have dataset of 4026*62rows and column and i have to do fuzzification "Accurate Cancer Classification Using Expressions of Very Few Genes"i.e I have to convert all thosevalues into three linguistic values low(L).average(A),high(L),I have coded but my program hangs on wen i run it,i have posted code ,please can anyone help,I need output as A,H,L, for 4026*62 rows and column % 1) FNN classifier: Full lymphoma dataset gene values should be converted into fuzzy values. Using the below code.
Fuzzification
[nu da]=xlsread('lymphoma dataset.xls')
cl=xlsread('class.xls');
for i=1:size(da,1)
for j=2:size(da,2)
if(j<size(da,2))
% x=str2num(da{i,j});
% if(isempty(x))
% x=0;
% end
else
c=unique(da(:,end));
% for i1=1:length(c)
% if(strcmp(c{i1},da{i,j}))
% x=i1;
% end
% end
% end
data(i,j-1)=x;
end
end
data1=data;
% data=data(1:300,:);
% cl=cl(1:150,:);
% data=nu;
disp('Dataset')
disp(data)
data=knnimpute(da)
[in claq]=kmeans(data,4);
for i=1:size(da,2)
d=data(:,i);
Emin=min(d);
Emax=max(d);
d1=sort(d,'ascend');
s=size(d,1)/3;
pj1=d(1:s,:);
pj2=d(s+1:end,:);
cl=in;
cla1=cl(1:s,:);
cla2=cl(s+1:end,:);
nc=10;
de=1;
k1 = mat2cell(pj1, nc*ones(1, (s/nc)),1);
k2 = mat2cell(pj2, nc*ones(1, (size(pj2,1)/nc)),1);
Rk1=(2*1)/length(pj1);
Rk2=(2*2)/length(pj2);
%class
figure('visible','off')
h = cdfplot(cla1);
y = get(h,'YData');
f1=length(y);
y = unique(y);
h1 = cdfplot(cla2);
y1 = get(h1,'YData');
f2=length(y1);
y1 = unique(y1);
low1=y(2);
low2=y1(2);
cf1=y(2)-y(1);
cf2=y1(2)-y1(1);
Pj1=low1+((Rk1-cf1)/f1)*de;
Pj2=low2+((Rk2-cf2)/f2)*de;
Aj1(i)=(Emin+ Pj1)/2;
Aj2(i) =(Pj1 + Pj2 )/2;
Aj3(i)= (Pj2 + Emax )/2;
end
c=unique(cl);
u1=[];
t = waitbar(0,'Applying Fuzzification ');
for i=1:size(data,1)
waitbar(i/size(data,1))
for j=1:size(data,2)-1
if(data(i,j)<=Aj1(j))
if(data(i,j)> Aj1(j) && data(i,j)<Aj2(j))
U(i,j)=(Aj2(j)-data(i,j))/(Aj2(j)-Aj1(j));
elseif(data(i,j)<Aj1(j))
U(i,j)=1;
else
U(i,j)=0;
end
u(i,j)=1;
u1{i,j}='L';
elseif(data(i,j)>=Aj1(j) && data(i,j)<=Aj3(j))
if(data(i,j)<= Aj1(j))
U(i,j)=0;
elseif(data(i,j)> Aj1(j) && data(i,j)<Aj2(j))
U(i,j)=(data(i,j)-Aj2(j))/(Aj2(j)-Aj1(j));
elseif(data(i,j)==Aj2(j))
U(i,j)=1;
elseif(data(i,j)> Aj2(j) && data(i,j)<Aj3(j))
U(i,j)=(Aj3(j)-data(i,j))/(Aj3(j)-Aj2(j));
else
U(i,j)=0;
end
u1{i,j}='A';
u(i,j)=2;
elseif(data(i,j)>=Aj3(j))
if(data(i,j)<= Aj2(j))
U(i,j)=0;
elseif(data(i,j)> Aj2(j) && data(i,j)<Aj3(j))
U(i,j)=(data(i,j)-Aj2(j))/(Aj3(j)-Aj2(j));
else
U(i,j)=1;
end
u1{i,j}='H';
u(i,j)=3;
end
end
end
close(t);
U(:,end+1)=cl;
disp('Fuzzy Dataset')
disp(U)

Answers (0)

This question is closed.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!