snf.compute.group_predict¶
-
snf.compute.
group_predict
(train, test, labels, *, K=20, mu=0.4, t=20)[source]¶ Propagates labels from train data to test data via SNF
Parameters: - train (m-list of (S1, F) array_like) – Input subject x feature training data. Subjects in these data sets should have been previously labelled (see: labels).
- test (m-list of (S2, F) array_like) – Input subject x feature testing data. These should be similar to the data in train (though the first dimension can differ). Labels will be propagated to these subjects.
- labels ((S1,) array_like) – Cluster labels for S1 subjects in train data sets. These could have
been obtained from some ground-truth labelling or via a previous
iteration of SNF with only the train data (e.g., the output of
sklearn.cluster.spectral_clustering()
would be appropriate). - K ((0, N) int, optional) – Hyperparameter normalization factor for scaling. See Notes of snf.affinity_matrix for more details. Default: 20
- mu ((0, 1) float, optional) – Hyperparameter normalization factor for scaling. See Notes of snf.affinity_matrix for more details. Default: 0.5
- t (int, optional) – Number of iterations to perform information swapping during SNF. Default: 20
Returns: predicted_labels – Cluster labels for subjects in test assigning to groups in labels
Return type: (S2,) np.ndarray