我試圖在R(h2o_3.14.0.2)中運行H2O的異常檢測。如何在H2O-R中創建異常檢測模型
首先,我試圖用我的主深度學習模型,並得到了錯誤:
water.exceptions.H2OIllegalArgumentException
[1] "water.exceptions.H2OIllegalArgumentException: Only for AutoEncoder Deep Learning model."
...
OK,我的壞。我已經設置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")
OK,所以我應該已經刪除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)
嗯,最後兩個要求看起來相互排斥。但是OK,我會嘗試另一種模式:
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。
所以我有兩個問題:
- 如何檢測異常?
- 這些是錯誤還是我做錯了什麼?
謝謝! 雖然錯誤消息應該更具描述性。 –