def fit(self, X, y=None):
        algorithm = self._choose_algorithm(self.algorithm, self.metric)
        X = check_array(X, order='C', dtype=DTYPE)

        kwargs = self.metric_params
        if kwargs is None:
            kwargs = {}
        self.tree_ = TREE_DICT[algorithm](X, metric=self.metric,
                                          leaf_size=self.leaf_size,
                                          **kwargs)
        return self
Fit the Kernel Density model on the data.
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/neighbors/kde.py/KernelDensity.fit