function covar

deeptime.covariance.covar(X, remove_mean=False, modify_data=False, weights=None, sparse_mode='auto', sparse_tol=0.0)

Computes the covariance matrix of X.

Computes \(C_{XX} = X^{\top} X\) while exploiting zero or constant columns in the data matrix.

WARNING: Directly use moments_XX() if you can. This function does an additional constant-matrix multiplication and does not return the mean.

Parameters:
  • X (ndarray (T, M)) – 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.

  • 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.

  • 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.

Returns:

C_XX – Covariance matrix of X

Return type:

ndarray (M, M)

See also

moments_XX