我使用 tidymodels 框架拟合多项逻辑回归模型来预测 iris 数据集中的物种。
library(tidymodels)
iris.lr = multinom_reg(
mode="classification",
penalty=NULL,
mixture=NULL
) %>%
set_engine("glmnet")
iris.fit = iris.lr %>%
fit(Species ~. , data = iris)
然后我想看看我的模型的系数并写出公式。我的理解是我应该从 iris.fit 得到这个。
iris.fit 的输出有一个包含 Df、%Dev、Lambda 的 100 行表。iris 数据集只有 4 个预测变量。如何将此输出转换为系数?