function moments_XXXY¶
- deeptime.covariance.moments_XXXY(X, Y, remove_mean=False, symmetrize=False, weights=None, 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.
If symmetrize is False, 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 \end{aligned}\]If symmetrize is True, computes
\[\begin{aligned} s_x = s_y &= \frac{1}{2} \sum_t (x_t + y_t)\\ C_XX &= \frac{1}{2} (X^\top X + Y^\top Y)\\ C_XY &= \frac{1}{2} (X^\top Y + Y^\top X) \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.
symmetrize (bool) – Computes symmetrized means and moments (see above)
weights (None or ndarray(T, )) – weights assigned to each trajectory point of X. If None, all data points have weight one. If ndarray, each data point is assigned a separate weight.
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
s_x (ndarray (M)) – x-sum
s_y (ndarray (N)) – y-sum
C_XX (ndarray (M, M)) – unnormalized covariance matrix of X
C_XY (ndarray (M, N)) – unnormalized covariance matrix of XY