gemmr.sample_analysis.macros.pairwise_weight_cosine_similarity

gemmr.sample_analysis.macros.pairwise_weight_cosine_similarity(ds, qs=(0.025, 0.975))

Calculates statistics of the weight-similarities from pairs of synthetic datasets.

All dimensions except n and x/y_features are stacked, and statistics are calculated across all these other dimensions.

For each pair of dataests the minimum cosine similarity across X and Y is used.

Parameters:
  • ds (xr.Dataset) – containing variables x_weights and y_weights at the minimum, and must have dimension n, x/y_feature, as well as at least one other dimension

  • qs (2-tuple of floats between 0 and 1) – quantiles of statistic

Returns:

  • xy_weight_cossim_mean (pd.Series (subsampled_n,)) – mean cosine similarity across pairs of datasets for each subsampled sample size

  • xy_weight_cossim_q (xr.DataArray (quantile, subsampled_n)) – quantiles of cosine similarity across pairs of datasets for each subsampled sample size