1function
MMAP = mamap22_fit_gamma_bs(M1, M2, M3, GAMMA,
P, B, S)
2% Performs approximate fitting of a
MMAP given the underlying MAP,
3% the
class probabilities (always fitted exactly), the backward moments,
4% and the one-step
class transition probabilities.
6% - M1,M2,M3: moments of the inter-arrival times
7% - GAMMA:
auto-correlation decay rate of the inter-arrival times
8% -
P:
class probabilities
9% - B: first-order backward moments
10% - S: one-step
class transition probabilities
12% - mmap: fitted MAMAP[2]
18% fit underlying AMAP(2)
19[~,MAPS] = amap2_fit_gamma(M1, M2, M3, GAMMA);
21% TODO: if it is a Poisson process then use second-order Poisson process
22% with (h1 - h2 + h2 r1 = 0)
24% fit marked Poisson process
25if length(MAPS) == 1 && size(MAPS{1}{1},1) == 1
29 % fit class probabilities
34 MMAP{2+c} = MMAP{2} .* P(c);
39% fit the MAMAP(2,m) using the underlying AMAP(2) form which produces the
41MMAPS = cell(1,length(MAPS));
42ERRORS = zeros(1,length(MAPS));
44 [MMAPS{j},fB,fS] = mamap22_fit_bs_multiclass(MAPS{j}, P, B, S);
45 ERRORS(j) = sum((fB(1)./B(1) - 1).^2) + sum((fS(1,1)./S(1,1) - 1).^2);
47[~,BEST] = min(ERRORS);