使用 h2o 的多项式回归中的部分依赖图

partial dependency plot in multinomial regression using h2o

我有以下 data.table.

  fixed acidity volatile acidity citric acid residual sugar chlorides free sulfur dioxide total sulfur dioxide density   pH
   1:           7.0             0.27        0.36           20.7     0.045                  45                  170 1.00100 3.00
   2:           6.3             0.30        0.34            1.6     0.049                  14                  132 0.99400 3.30
   3:           8.1             0.28        0.40            6.9     0.050                  30                   97 0.99510 3.26
   4:           7.2             0.23        0.32            8.5     0.058                  47                  186 0.99560 3.19
   5:           7.2             0.23        0.32            8.5     0.058                  47                  186 0.99560 3.19   

sulphates alcohol   quality
   1:      0.45     8.8  Bad wine
   2:      0.49     9.5  Bad wine
   3:      0.44    10.1  Bad wine
   4:      0.40     9.9  Bad wine
   5:      0.40     9.9  Bad wine

我可以运行

system.time(model_glm <- h2o.glm(x = 1:11, y = 12, training_frame = wine.train.h2o,
                                 validation_frame = wine.test.h2o, seed = 42,
                                 family = "binomial"))

在此数据集上训练 glm。稍后为了获得部分依赖图,我可以使用

glm_pp <- rbindlist(lapply(glm_pp, function(x){melt(x, id.vars="mean_response")}))
ggplot(glm_pp, aes(x=value, y=mean_response)) + geom_point()  + facet_wrap(~variable, scale="free_x") +
  geom_smooth(method="loess") + theme_pl() + ggtitle("Partial dependence plot")

在我的例子中,我的 yquality,也就是 binary variable

如果我的 dependent variable 有 3 个或更多类别,我怎么能得到部分依赖图,所以如果我 运行 glm 使用 family = multinomial

目前 H2O 在其部分依赖实现中支持二项式和回归模型。多项式模型尚不兼容。

-导航