came.utils.preprocess.group_mean

came.utils.preprocess.group_mean(X: ndarray | spmatrix, labels: Sequence, binary: bool = False, classes=None, features=None, **kwds)

compute the group averaged features

Parameters:
  • X (np.ndarray or sparse.spmatrix) – shape (n_samples, n_features)

  • labels – shape (n_samples, )

  • binary – if True, the results will be the non-zero proportions

  • classes – optional, names of groups

  • features – optional, names of features

Returns:

average_mat

Return type:

pd.DataFrame