Exemplo n.º 1
0
    def from_labels(cls, labels_true, labels_pred, is_class_pos=num2bool):
        """Instantiates class from arrays of classes and cluster sizes

        Parameters
        ----------

        labels_true : array, shape = [n_samples]
            Class labels. If binary, 'is_class_pos' is optional

        labels_pred : array, shape = [n_samples]
            Cluster labels to evaluate

        is_class_pos: label_true -> Bool
            Boolean predicate used to binarize true (class) labels

        """
        clusters = labels_to_clusters(labels_true, labels_pred)
        return cls.from_clusters(clusters, is_class_pos=is_class_pos)
Exemplo n.º 2
0
    def from_labels(cls, labels_true, labels_pred, is_class_pos=num2bool):
        """Instantiates class from arrays of classes and cluster sizes

        Parameters
        ----------

        labels_true : array, shape = [n_samples]
            Class labels. If binary, 'is_class_pos' is optional

        labels_pred : array, shape = [n_samples]
            Cluster labels to evaluate

        is_class_pos: label_true -> Bool
            Boolean predicate used to binarize true (class) labels

        """
        clusters = labels_to_clusters(labels_true, labels_pred)
        return cls.from_clusters(clusters, is_class_pos=is_class_pos)
Exemplo n.º 3
0
 def show_cluster(self, idx, inverse=False):
     grid = self.grid
     a, b = (1, 0) if inverse else (0, 1)
     return labels_to_clusters(grid[a][idx], grid[b][idx])
Exemplo n.º 4
0
 def show_cluster(self, idx, inverse=False):
     grid = self.grid
     a, b = (1, 0) if inverse else (0, 1)
     return labels_to_clusters(grid[a][idx], grid[b][idx])