从 h2o 性能中获取 mse 并将其保存在变量中。

take mse from h2o performance and save it in a variable.

我在 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。

获取均方误差

要获取均方误差 (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() 函数本身不包含或 return 混淆矩阵。


参考资料

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