neighbors.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:kenchi 作者: Y-oHr-N 项目源码 文件源码
def fit(self, X, y=None):
        """Fit the model according to the given training data.

        Parameters
        ----------
        X : array-like of shape (n_samples, n_features)
            Samples.

        Returns
        -------
        self : detector
            Return self.
        """

        X                 = check_array(X)

        self._knn         = NearestNeighbors(
            metric        = self.metric,
            metric_params = self.metric_params,
            n_jobs        = self.n_jobs,
            n_neighbors   = self.n_neighbors,
            p             = self.p
        ).fit(X)

        self.y_score_     = self.anomaly_score()
        self.threshold_   = np.percentile(
            self.y_score_, 100.0 * (1.0 - self.fpr)
        )

        return self
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号