如何设置名为“方法"的模型子参数?来自 caret 的 train() 函数 [英] How do I set a model sub-parameter named "method" from caret's train() function

查看:57
本文介绍了如何设置名为“方法"的模型子参数?来自 caret 的 train() 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 polr 包从 caret 的 train() 函数构建序数逻辑回归模型.polr 模型有一个名为method"的参数,该参数与 train() 的参数method"冲突.我想将 polr 模型参数设置为logistic".

I am trying to build an ordinal logistic regression model from caret's train() function using the polr package. The polr model has a parameter named "method" that clashes with train()'s parameter "method". I want to set to the polr model parameter to "logistic".

我该怎么做?

谢谢!

推荐答案

使用polr时需要在train的tunegrid选项中指定方法.

When using polr you need to specify the method in the tunegrid option of train.

在公式符号中,它应该是这样的:

In the formula notation it should look like this:

train(y ~ x1 + x2, 
      data = my_data, 
      method = "polr", 
      trControl = my_control, 
      tunegrid = expand.grid(method = "logistic"))

这篇关于如何设置名为“方法"的模型子参数?来自 caret 的 train() 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆