gpt4 book ai didi

machine-learning - 对sklearn对OSVM的实现感到困惑

转载 作者:行者123 更新时间:2023-11-30 09:47:56 25 4
gpt4 key购买 nike

我最近开始尝试使用 OneClassSVM(使用 Sklearn)进行无监督学习,并且我遵循了 this example

我对这些愚蠢的问题表示歉意,但我对两件事有点困惑:

  1. 我应该在常规示例案例和异常值上训练支持向量机,还是仅在常规示例上进行训练?

  2. OSVM 预测并代表异常值的标签是 1 还是 -1

我再次对这些问题表示歉意,但由于某种原因我找不到此记录的任何软件

最佳答案

由于您引用的这个示例是关于新颖性检测的,因此 docs说:

novelty detection:

The training data is not polluted by outliers, and we are interested in detecting anomalies in new observations.

含义:您应该仅使用常规示例进行训练。

该方法基于:

Schölkopf, Bernhard, et al. "Estimating the support of a high-dimensional distribution." Neural computation 13.7 (2001): 1443-1471.

摘录:

Suppose you are given some data set drawn from an underlying probability distribution P and you want to estimate a “simple” subset S of input space such that the probability that a test point drawn from P lies outside of S equals some a priori specied value between 0 and 1.

We propose a method to approach this problem by trying to estimate a function f that is positive on S and negative on the complement.

上面的文档还说:

Inliers are labeled 1, while outliers are labeled -1.

这也可以在您的示例代码中看到,提取:

# Generate some regular novel observations
X = 0.3 * np.random.randn(20, 2)
X_test = np.r_[X + 2, X - 2]
...
# all regular = inliers (defined above)
y_pred_test = clf.predict(X_test)
...
# -1 = outlier <-> error as assumed to be inlier
n_error_test = y_pred_test[y_pred_test == -1].size

关于machine-learning - 对sklearn对OSVM的实现感到困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49873952/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com