【发布时间】:2017-11-13 00:44:26
【问题描述】:
我正在尝试在 R (h2o_3.14.0.2) 中运行 H2O 的异常检测。
首先,我尝试使用我的主要深度学习模型并得到错误:
water.exceptions.H2OIllegalArgumentException
[1] "water.exceptions.H2OIllegalArgumentException: Only for AutoEncoder Deep Learning model."
...
好吧,我的错。我已将autoencoder 设置为TRUE:
h2o.deeplearning(y = response, training_frame = training.frame, validation_frame = test.frame, autoencoder = TRUE)
又出现新错误:
Error in .verify_dataxy(training_frame, x, y, autoencoder): `y` should not be specified for autoencoder=TRUE, remove `y` input
Traceback:
1. h2o.deeplearning(y = response, training_frame = training.frame,
. validation_frame = test.frame, autoencoder = TRUE)
2. .verify_dataxy(training_frame, x, y, autoencoder)
3. stop("`y` should not be specified for autoencoder=TRUE, remove `y` input")
好的,所以我应该删除y:
h2o.deeplearning(training_frame = training.frame, validation_frame = test.frame, autoencoder = TRUE)
但是:
Error in is.numeric(y): argument "y" is missing, with no default
Traceback:
1. h2o.deeplearning(training_frame = training.frame, validation_frame = test.frame,
. autoencoder = TRUE)
2. is.numeric(y)
嗯,最后两个要求看起来是互斥的。不过好吧,我试试别的模型:
anomaly.detection.model <- h2o.glrm(training_frame = training.frame, k = 10, seed = common.seed)
h2o.anomaly(anomaly.detection.model, training.frame, per_feature = FALSE)
并得到另一种类型的错误:
java.lang.AssertionError
[1] "java.lang.AssertionError"
[2] " water.api.ModelMetricsHandler.predict(ModelMetricsHandler.java:439)"
...
失败的断言是assert s.reconstruct_train;。还没有深究。也许我会在 GBM 或 RF 上运气好?
model = h2o.gbm(y = response,
training_frame = training.frame,
validation_frame = validation.frame,
max_hit_ratio_k = 10,
seed = common.seed,
stopping_rounds = 3,
stopping_tolerance = 1e-2)
h2o.anomaly(model, training.frame, per_feature = FALSE)
water.exceptions.H2OIllegalArgumentException
[1] "water.exceptions.H2OIllegalArgumentException: Requires a Deep Learning, GLRM, DRF or GBM model."
RF 也是如此。
所以我有两个问题:
- 如何检测异常?
- 这些是错误还是我做错了什么?
【问题讨论】: