我使用oneclasssvm如下。你知道吗
from sklearn.svm import OneClassSVM
clf = OneClassSVM(random_state=42)
clf.fit(X)
y_pred_train = clf.predict(X)
print(len(np.where(y_pred_train == -1)[0]))
然而,我得到了超过50%的数据作为异常值。我想知道是否有一种方法可以减少一类svm中异常值的数量。你知道吗
我试过contamination
。然而,似乎oneclasssvm不支持污染。你知道吗
我还有别的方法可以用吗?你知道吗
如果需要,我很乐意提供更多细节。你知道吗
我很想了解您使用的样本点的方差、维度和数量,但我的第一个建议是:
从Docs
通过控制OneClassSVM的
nu
参数,可以控制训练数据中有多少数据点被标记为异常值。你知道吗在API文档中,nu是,
An upper bound on the fraction of training errors and a lower bound of the fraction of support vectors. Should be in the interval (0, 1]. By default 0.5 will be taken.
我建议您使用一个带标签的验证集,然后调整SVM超参数,比如
nu
。kernel
等,以便在标记的验证集上获得最佳性能。你知道吗相关问题 更多 >
编程相关推荐