Example #1
0
    def fit(self, y):
        """Fit label binarizer

        Parameters
        ----------
        y : Dask.Array of shape [n_samples,] or [n_samples, n_classes]
            chunked by row.
            Target values. The 2-d matrix should only contain 0 and 1,
            represents multilabel classification.

        Returns
        -------
        self : returns an instance of self.
        """

        # Take the unique classes and broadcast them all around the cluster.
        futures = self.client.sync(_extract_partitions, y)

        unique = [
            self.client.submit(LabelBinarizer._func_unique_classes, f)
            for w, f in futures
        ]

        classes = self.client.compute(unique, True)
        classes = rmm_cupy_ary(cp.unique,
                               rmm_cupy_ary(cp.stack, classes, axis=0))

        self._set_internal_model(LB(**self.kwargs).fit(classes))

        return self
Example #2
0
 def _func_create_model(**kwargs):
     return LB(**kwargs)