came.weight_linked_vars

came.weight_linked_vars(X: ndarray, adj: spmatrix, names: Sequence | None = None, metric: str = 'cosine', func_dist2weight: Callable | None = None, sigma: float | None = None, sort: bool = True, index_names=(0, 1), **ignored) DataFrame

Computes the similarity of each linked (homologous) pair of variables.

Parameters:
  • X (np.ndarray) – feature matrix of shape (N, M), where N is the number of sample and M is the feature dimensionality.

  • adj – sparse.spmatrix; binary adjacent matrix of shape (N, N). Note that only the upper triangle of the matrix will be considered!

  • names – a sequence of names for rows of X, of shape (N,)

  • metric – the metric to quantify the similarities of the given vectors (embeddings)

  • sort – whether to sort by the resulting weights

  • index_names – a pair of names for the multi-index of the resulting DataFrame. e.g., a pair of dataset or species names (in cross-species scenario)

Returns:

df – with columns [index_names[0], index_names[1], “distance”, “weight”]

Return type:

pd.DataFrame