LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
mtrace_backward_moment.m
1function [M] = mtrace_backward_moment(T,A,ORDERS,NORM)
2% Computes the backward 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 B_{i,c}: M_i = sum B_{i,c}
8% 1 (default) to return B_{i,c}: M_i = sum B_{i,c} * p_c
9% where
10% M_i is the class independent moment of order i
11% B_{i,c} is the class-c backward moment of order i
12% p_c is the probability of arrivals of class c
13% Output:
14% - MOMENTS: the backward moments as a matrix B(c,i) = B_{i,c}
15
16% by default, moments are normalized
17if nargin == 3
18 NORM = 1;
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.^k .* (A==MARKS(c)));
31 if NORM
32 M(c,j) = M(c,j) * length(T)/sum(A==MARKS(c));
33 end
34 end
35end
36
37end