nimare.annotate.cogat.expand_counts

expand_counts(counts_df, rel_df=None, weights=None)[source]

Perform hierarchical expansion of counts across labels.

Parameters:
  • counts_df ((D x T) pandas.DataFrame) – Term counts for a corpus. T = term, D = document.

  • rel_df (pandas.DataFrame) – Long-form DataFrame of term-term relationships with at least three columns: ‘input’, ‘output’, and ‘rel_type’.

  • weights (dict) – Dictionary of weights per relationship type. E.g., {‘isKind’: 1}. Unspecified relationship types default to 0.

Returns:

weighted_df – Term counts for a corpus after hierarchical expansion.

Return type:

(D x T) pandas.DataFrame