def compute_groups_indices(self, X, y, label):
        mask = y == label
        self.random_state = check_random_state(self.random_state)
        knn_indices = computeSignalKnnIndices(self.uniform_variables, X, mask,
                                              n_neighbors=self.n_neighbours)[mask, :]
        if len(knn_indices) > self.max_group_on_iteration:
            selected_group = self.random_state.choice(len(knn_indices), size=self.max_group_on_iteration)
            return knn_indices[selected_group, :]
        else:
            return knn_indices

# endregion
dataset/ETHPy150Open anaderi/lhcb_trigger_ml/hep_ml/losses.py/KnnFlatnessLossFunction.compute_groups_indices/original