1function [fit,m3pps] = m3pp22_interleave_fitc(av, btv, binfv, stv, t)
2% Fits L pairs of
classes into a single
MMAP, obtained by lumped
3% superposition of L different M3PP[2] processes.
5% - av: Matrix of size Lx2 containing the per-
class rates.
6% - btv: Vector of length L containing the IDC at resolution t
for each
8% - binfv: Vector of length L containing the asymptotic IDC
for each pair
10% - stv: Vector of length L containing the count covariance, at
11% resolution t, between each pair of
classes.
13% - fit: The lumped superposition of the M3PP[2] processes.
14% - m3pps: Cell-array of length L containing the M3PP[2] processes.
19% vector of lower bounds
for the upper off-diagonal elements
21% vector of upper bounds
for the upper off-diagonal elements
24% compute bounds
for the upper off-diagonal elment of each mmpp(2)
27 d = compute_d(btv(i), binfv(i), t);
28 z = (binfv(i)-1)*d^3*a;
29 u = d*z/(2*a^2*d^2+z);
34% find feasible values for off diagonal elements
45 b(base+1) = dv(i)-1e-6;
46 b(base+2) = -uv(i)-1e-6;
64x = linprog(f, A, b, Aeq, beq, zeros(2*L,1), [], []);
67r(2,:) = x((L+1):(2*L));
69% fit m3pp[2] processes
72 % fit underling mmpp(2)
88 z = (binfv(i)-1)*d^3*a;
89 delta = sqrt(z/(2*r1*r2));
90 l2 = a - r2/d * delta;
94 drates = -sum(mmpp{1}+mmpp{2},2);
96 mmpp{1}(j,j) = drates(j);
99 v = map_count_var(mmpp, t);
100 fprintf(
'MMPP %d - Var(t): %d\n', i, v);
102 m3pps{i} = m3pp22_fitc_approx_cov_multiclass(mmpp, av(i,:)
', stv(i), t);
106fit = m3pp2m_interleave(m3pps);
108 % solve non-linear equation to fit underlying mmpp(2)
109 function d = compute_d(bt1,binf,t1)
110 if ~(binf>bt1 && bt1>1)
111 error('No solution, infeasible IDC(t): IDC(%.2f) = %.3f, IDC(inf) = %.3f\n
',...
115 c = (binf-1)/(binf-bt1);
116 % according to WolframAlpha
117 % the solution can be written as (ProductLog[-c e^(-c)]+c)/t1
119 w = fsolve(@(w) z-w*exp(w), 1, optimset('Display
','none
',...
121 'MaxFunEvals
',10000,...
122 'TolFun
', 1.0e-12,...