【问题标题】:Isolation Forest for Anomaly Detection用于异常检测的隔离森林
【发布时间】:2020-02-13 13:49:38
【问题描述】:

IsolationForestexample 中用于异常检测:

import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import IsolationForest

rng = np.random.RandomState(42)

# Generate train data
X = 0.3 * rng.randn(100, 2)
X_train = np.r_[X + 2, X - 2]
# Generate some regular novel observations
X = 0.3 * rng.randn(20, 2)
X_test = np.r_[X + 2, X - 2]
# Generate some abnormal novel observations
X_outliers = rng.uniform(low=-4, high=4, size=(20, 2))

# fit the model
clf = IsolationForest(max_samples=100, random_state=rng)
clf.fit(X_train)
y_pred_train = clf.predict(X_train)
y_pred_test = clf.predict(X_test)
y_pred_outliers = clf.predict(X_outliers)

我相信这段代码中的异常值是随机引入的。 但是,如果我使用真实数据进行异常检测,那么:

  • 我该如何推进?

  • 如果我已有数据集,如何识别异常? 我正在尝试联合循环发电厂dataset。 或者,如果您有任何其他好的异常检测实践数据集,请删除一些链接!

【问题讨论】:

  • 你是什么意思“我该如何推进”?

标签: python machine-learning anomaly-detection industrial


【解决方案1】:

如果您要求数据集中的污染。然后您需要检查污染参数。

clf = IsolationForest(max_samples=100, random_state=rng, contamination='auto')

这是基于数据具有一定程度的污染的假设。

【讨论】:

    【解决方案2】:

    rng 是随机数。您可以将其视为合成数据集。对于现实世界的数据集,您必须使用numpypandasload 函数来加载它。

    你可以在这里找到一些异常检测任务的数据集http://odds.cs.stonybrook.edu

    到目前为止,我可以说 Prophet 是一个流行的时间序列分析任务框架,其中包括流数据的异常检测https://www.kaggle.com/vinayjaju/anomaly-detection-using-facebook-s-prophet

    【讨论】:

      猜你喜欢
      • 2017-12-16
      • 2020-10-20
      • 2020-11-16
      • 2018-05-25
      • 1970-01-01
      • 1970-01-01
      • 2021-01-04
      • 2018-09-10
      • 2019-07-11
      相关资源
      最近更新 更多