LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
mtrace_forward_moment.m
1function [M] = mtrace_forward_moment(T,A,ORDERS,NORM)
2% Computes the forward moments of a marked trace.
3% Input:
4% - T: the inter-arrival times
5% - C: the class labels
6% - ORDERS: vector with the orders of the moments to compute
7% - NORM: 0 to return F_{i,c}: M_i = sum F_{i,c}
8% 1 (default) to return F_{i,c}: M_i = sum F_{i,c} * p_c
9% where
10% M_i is the class independent moment of order i
11% F_{i,c} is the class-c forward moment of order i
12% p_c is the probability of arrivals of class c
13% Output:
14% - MOMENTS: the forward moments as a matrix F(c,i) = F_{i,c}
15
16% by default, moments are normalized
17if nargin == 3
18 NORM = 3;
19end
20
21MARKS = unique(A);
22
23C = length(MARKS);
24
25M = zeros(C,length(ORDERS));
26
27for j = 1:length(ORDERS)
28 k = ORDERS(j);
29 for c = 1:C
30 M(c,j) = mean(T(2:end).^k .* (A(1:(end-1)) == MARKS(c)));
31 if NORM
32 M(c,j) = M(c,j) * length(T-1)/sum(A(1:(end-1))==MARKS(c));
33 end
34 end
35end
36
37end