Skip to content

Commit

Permalink
Still trying to figure this out
Browse files Browse the repository at this point in the history
  • Loading branch information
mldiego committed Feb 20, 2024
1 parent 0fe9252 commit 24c8883
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
16 changes: 14 additions & 2 deletions code/nnv/engine/set/Star.m
Original file line number Diff line number Diff line change
Expand Up @@ -1166,9 +1166,21 @@
if obj.dim ~= S.dim
error('Two sets have different dimension');
end

if isa(obj.V, 'single') || isa(obj.C,'single') || isa(obj.d, 'single')
S1 = obj.changeVarsPrecision('double');
else
S1 = obj;
end

if isa(S.V, 'single') || isa(S.C,'single') || isa(S.d, 'single')
S2 = S.changeVarsPrecision('double');
else
S2 = S;
end

P1 = obj.toPolyhedron();
P2 = S.toPolyhedron();
P1 = S1.toPolyhedron();
P2 = S2.toPolyhedron();

bool = (P1 <= P2);

Expand Down
45 changes: 45 additions & 0 deletions code/nnv/examples/NN/medmnist/process_debugNodule.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,48 @@
figure;
Star.plot(R3,'r');


% Let's see what the differences in the layer-by-layer sets are...

% Layer 1
r1 = R1a{5}{1};
r2 = R2a{5}{1};
r3 = R3a{5}{1};

rs1 = r1.toStar;
rs2 = r2.toStar;
rs3 = r3.toStar;

% The next 3 statements should return true
% bool1 = rs1.isSubSet(rs2);
% bool2 = rs1.isSubSet(rs3);
% bool3 = rs2.isSubSet(rs3);
% this takes too long as stars are high dimensional (polyhedron not very
% efficient)

% get ranges (overapprox) and see if the smaller bounds are within te
% larger ones (rs1 < rs2 < rs3)
[rs1L, rs1U] = rs1.estimateRanges;
[rs2L, rs2U] = rs2.estimateRanges;
[rs3L, rs3U] = rs3.estimateRanges;

b1L = all(rs1L >= rs2L);
b1U = all(rs1U <= rs2U);
b2L = all(rs1L >= rs3L);
b2U = all(rs1U <= rs3U);
b3L = all(rs2L >= rs3L);
b3U = all(rs2U <= rs3U);

% Lower bounds seem fine, but ot the upper bounds...

% where do these assertions fail?
u1 = find(rs1U > rs2U);
u2 = find(rs1U > rs3U);
u3 = find(rs2U > rs3U);

% these fail on all the perturbed pixels...
uu11 = rs1L(u1);
uu12 = rs2L(u1);

% we are not defining the constraints on the input set correctly, some
% pixel values are outside the valid ranges...

0 comments on commit 24c8883

Please sign in to comment.