0

我在 h2o(R) 中有一个模型。它的性能产生

h2o.performance(models[[1]],valid=T)

给出输出

H2ORegressionMetrics: deeplearning
** Reported on validation data. **
Description: Metrics reported on temporary validation frame with 9724 samples

MSE:  1.18963
R2 :  0.07689513
Mean Residual Deviance :  1.18963

我想采用 MSE 并将其保存在变量中。我尝试使用生成混淆矩阵

 h2o.confusionMatrix(h2o.performance(models[[i]],valid=T))

但它会生成 NULL。

4

1 回答 1

3

获得均方误差

要获取均方误差 (MSE) 值,您可以使用该h2o.mse()函数,如下例所示 (Aiello, Kraljevic, & Maj, 2015):

perf <- h2o.performance(model = your_data_file.gbm, data = your_data_file.hex)
your_new_variable <- h2o.mse(perf)

示例结果

> h2o.performance(model = your_data_file.gbm, data = your_data_file.hex)
H2OBinomialMetrics: gbm
** Reported on training data. **

MSE:  0.07584147
R^2:  0.6846763
LogLoss:  0.2744668
AUC:  0.9780312
Gini:  0.9560623

> perf <- h2o.performance(model = your_data_file.gbm, data = your_data_file.hex)
> your_new_variable <- h2o.mse(perf)
> your_new_variable
[1] 0.07584147

关于混淆矩阵

此外,混淆矩阵中的 NULL 值可能表明您的h2o.performance()函数本身不包含或返回混淆矩阵。


参考

Aiello, S.、Kraljevic, T. 和 Maj, P.(2015 年 11 月 24 日)。包'h2o'。检索于 2015 年 12 月 2 日,来自https://cran.r-project.org/web/packages/h2o/h2o.pdf

于 2015-12-02T22:49:01.553 回答