LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
mamap2m_fit_trace.m
1function MMAP = mamap2m_fit_trace(T, C, fbsWeights)
2% Fits a MAPH(2,m) or A MAMAP(2,m) that matches the characteristics of the
3% trace. Three characteristics of the marked process are matched either
4% exactly or approximately. Among these, the class probabilities are always
5% matched exactly. The remaining two characteristics, by default, are the
6% forward and backward moments, unless the underlying AMAP(2) is
7% degenerate. Different pairs of characteristics can be chosen by
8% specifying higher weights in the optional parameter fbsWeights.
9%
10% Input
11% - T: the inter-arrival times
12% - C: the class labels
13% - fbsWeights: the weight assigned to forward moments, backward moments
14% and class transition probabilities (default: [1, 1, 1])
15% Output
16% - MMAP: fitted MAMAP[m]
17
18if nargin == 2
19 % by default equal weights
20 % when weights are equal, F+B is preferred over F+S and B+S
21 fbsWeights = [1 1 1];
22end
23
24M1 = mean(T);
25M2 = mean(T.^2);
26M3 = mean(T.^3);
27GAMMA = trace_gamma(T);
28
29P = mtrace_pc(T,C);
30F = mtrace_forward_moment(T,C,1);
31B = mtrace_backward_moment(T,C,1);
32S = mtrace_sigma(T,C);
33
34MMAP = mamap2m_fit(M1, M2, M3, GAMMA, P, F, B, S, fbsWeights);
35
36end