gemmr.sample_analysis.addon.weights_pc_cossim

gemmr.sample_analysis.addon.weights_pc_cossim(estr, X, Y, Xorig, Yorig, x_align_ref, y_align_ref, results, **kwargs)

Calculates cosine-similarities of principal component axes of X and Y with corresponding weights.

Requires keyword arguments: None

Provides outcome metrics x_weights_pc_cossim, y_weights_pc_cossim.

Parameters:
  • estr (sklearn-style estimator) – fitted estimator

  • X (np.ndarray (n_samples, n_features)) – dataset X

  • Y (np.ndarray (n_samples, n_features)) – dataset Y

  • Xorig (None or np.ndarray (n_samples, n_orig_features)) – can be None. Allows to provide an alternative set of X features for calculating loadings. I.e. an implicit assumption is that the rows in X and Xorig correspond to the same samples (subjects).

  • Yorig (None or np.ndarray (n_samples, n_orig_features)) – can be None. Allows to provide an alternative set of Y features for calculating loadings. I.e. an implicit assumption is that the rows in Y and Yorig correspond to the same samples (subjects).

  • x_align_ref ((n_features,)) – the sign of X weights is chosen such that the cosine-distance between fitted X weights and x_align_ref is positive

  • y_align_ref ((n_features,)) – the sign of Y weights is chosen such that the cosine-distance between fitted Y weights and y_align_ref is positive

  • results (xr.Dataset) – containing outcome features computed so far, and is modified with outcomes of this function

  • kwargs (dict) – keyword arguments