在python中是否必须为隔离林设置污染值?

2024-05-14 08:53:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我将构建一个模型来识别数据集中的异常。我做了很多研究,发现隔离林是最好的。在我的数据集中,我没有任何标签(这意味着数据集只包含解释性变量)。但是我不知道在隔离林中设置污染参数(大多数解释的文章已经有了输出变量[标记为异常],他们使用该变量计算离群值比率,然后将其设置为污染值

必须设置吗?。污染物的默认值为0.1。可以忽略它吗如果我没有给它赋值,它会影响模型结果吗?

model = IsolationForest(contamination=0.1, n_estimators=1000)

Tags: 数据标记模型参数model文章标签比率
1条回答
网友
1楼 · 发布于 2024-05-14 08:53:49

不,不强制设置污染值。默认情况下,它设置为“自动”

contamination‘auto’ or float, default=’auto’ The amount of contamination of the data set, i.e. the proportion of outliers in the data set. Used when fitting to define the threshold on the scores of the samples.

Reference in documentation

因此,您可以忽略它,但它可以/将影响模型结果,因为预测方法使用由污染值设置的阈值

The predict method makes use of a threshold on the raw scoring function computed by the estimator. This scoring function is accessible through the score_samples method, while the threshold can be controlled by the contamination parameter.

Reference in documentation

相关问题 更多 >

    热门问题