function moments_block¶
- deeptime.covariance.moments_block(X, Y, remove_mean=False, modify_data=False, sparse_mode='auto', sparse_tol=0.0, column_selection=None, diag_only=False)¶
Computes the first two unnormalized moments of X and Y forward and backward.
Computes
\[\begin{aligned} s_x &= \sum_t x_t\\ s_y &= \sum_t y_t\\ C_{XX} &= X^\top X\\ C_{XY} &= X^\top Y\\ C_{YX} &= Y^\top X\\ C_{YY} &= Y^\top Y \end{aligned}\]while exploiting zero or constant columns in the data matrix.
- Parameters:
X (ndarray (T, M)) – Data matrix
Y (ndarray (T, N)) – Second data matrix
remove_mean (bool) – True: remove column mean from the data, False: don’t remove mean.
modify_data (bool) – If remove_mean=True, the mean will be removed in the data matrix X, without creating an independent copy. This option is faster but might lead to surprises because your input array is changed.
sparse_mode (str) –
- one of:
’dense’ : always use dense mode
’sparse’ : always use sparse mode if possible
’auto’ : automatic
sparse_tol (float) – Threshold for considering column to be zero in order to save computing effort when the data is sparse or almost sparse. If max(abs(X[:, i])) < sparse_tol, then row i (and also column i if Y is not given) of the covariance matrix will be set to zero. If Y is given and max(abs(Y[:, i])) < sparse_tol, then column i of the covariance matrix will be set to zero.
column_selection (ndarray(k, dtype=int) or None) – Indices of those columns that are to be computed. If None, all columns are computed.
diag_only (bool) – If True, the computation is restricted to the diagonal entries (autocorrelations) only.
- Returns:
w (float) – statistical weight of this estimation
s ([ndarray (M), ndarray (M)]) – list of two elements with s[0]=sx and s[1]=sy
C ([[ndarray(M,M), ndarray(M,N)], [ndarray(N,M),ndarray(N,N)]]) – list of two lists with two elements. C[0,0] = Cxx, C[0,1] = Cxy, C[1,0] = Cyx, C[1,1] = Cyy