gemmr.generative_model._assemble_Sigmaxy_pls

gemmr.generative_model._assemble_Sigmaxy_pls(Sigmaxx, Sigmayy, U_, V_, m, true_corrs)

Generates the between-set covariance matrix.

The between-set covariance matrix is given by

\[\Sigma_{XY} = W_X \mathrm{diag}( \vec{\sigma}_{XY}) W_Y^T\]

where \(W_X\) and \(W_Y\) are matrices whose columns are the weight vectors for the between-set associations (given by arguments U_ and V_, respectively) and the entries of \(\vec{\sigma}_{XY}\) give the associated covariance calculated as

\[\sigma_{XY,i} = \rho_{XY,i} \sqrt{\mathrm{var}(X \vec{w}_{X,i}) \mathrm{var}(Y \vec{w}_{Y,i})}\]

The true correlations \(\rho_{XY,i}\) are contained in the argument true_corrs.

If the calculated vector of covariances \(\vec{\sigma}_{XY}\) is not monotonously decreasing, modes (i. e. true_corrs, U_ and V_) will be reordered to make it monotonously decreasing. Otherwise, the returned values of true_corrs, U_ and V_ are identical to the input values.

With the generated \(\Sigma_{XY}\) the joint covariance matrix \(\Sigma\) can be assembled. To test its positive-definiteness, this function also returns the minimal eigenvalue of a Schur complement of \(\Sigma\) (which is > 0 if and only if \(\Sigma\) is positive definite).

Parameters:
  • Sigmaxx (np.ndarray (px, px)) – within-set covariance matrix for X
  • Sigmayy (np.ndarray (py, py)) – within-set covariance matrix for Y
  • U (np.ndarray (px, m)) – weight vectors for between-set association modes in X
  • V (np.ndarray (py, m)) – weight vectors for between-set association modes in Y
  • m (int) – number of between-set association modes
  • true_corrs (np.ndarray (m,)) – assumed correlations for the between-set association modes
Returns:

  • Sigmaxy (np.ndarray (px, py)) – between-set covariance matrix
  • Sigmaxy_svals (np.ndarray (m,)) – singular values of Sigmaxy, these are the true canonical covariances
  • U_ (np.ndarray (px, m)) – weight vectors for between-set association modes in X
  • V_ (np.ndarray (py, m)) – weight vectors for between-set association modes in Y
  • min_eval (float) – smallest eigenvalue of the Schur complement of either Sigmaxx or Sigmayy (whichever has a larger dimension) of the joint covariance matrix \(\Sigma\). \(\Sigma\) is positive definite if and only if min_eval is > 0.
  • true_corrs (np.ndarray (m,)) – assumed correlations for the between-set association modes