nonparametric.py 文件源码

python
阅读 29 收藏 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._kde         = KernelDensity(
            bandwidth     = self.bandwidth,
            kernel        = self.kernel,
            metric        = self.metric,
            metric_params = self.metric_params
        ).fit(X)

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

        return self
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号