Need help to compute the maximal block of similar objects in a set
1 次查看(过去 30 天)
显示 更早的评论
Given the following table
Cases Temperature Headache Nausea Flu
x1 High NaN No Yes
x2 Very high Yes Yes Yes
x3 NaN No No No
x4 High Yes Yes Yes
x5 High NaN Yes No
x6 Normal Yes No No
x7 Normal No Yes No
x8 NaN Yes NaN Yes
where xs are set of objects, {Temperature, Headache, Nausea} are set of attributes and {flu} is the only decision attribute I compute the similar object with respect to tolerance relation as the following equation
S_A(x) = {(x,y) \in U x U: \forall a \in A, f_a(x) = f_a(y) or f_a(x) = NaN or f_a(y) = NaN} where f_a(x) is the value of x with respect to attribute a. This leads to (for short i will refer to x1 only)
S_A(x_1) = \{x1,x3,x8} my problem is that i need to split the objects that have different values to find the maximal blocks of similar objects as follows
S_A(x_1) &= {{x1, x3},{x1,x8}}
Here is my code, but i doesn't work very well
spMBL = zeros();%set of maximal blocks
count = 0;
for i = 1:size(sp,1)
for j = 1:size(sp, 2)
if sp(i,j) == 0
continue;
end
ind = sp(i,j);
for k = 1:size(sp, 2)
if sp(i,k) == 0
continue;
end
bool = 1;
for l = 1:size(ind,1)
bool = bool * islimited(Data(ind(l),:), Data(sp(i,k),:));
end
if bool == 1 && sp(i,j) ~= sp(i,k)
ind = [ind;sp(i,k)];
end
end
count = count + 1;
for m = 1:size(ind,1)
spMBL(count, m) = ind(m);
end
ind = [];
end
end
for i = 1:size(sp,1)
if isequal(sp(i,2),0)
count = count + 1;
spMBL(count, 1) = sp(i,1);
end
end
Where Sp is the set of tolerance sets (S_A(x1)...S_A(xn)) Can anyone provide a more powerful pseudocode which could do this (or matlab function)?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Approximate Functions with Lookup Tables 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!