如何使用多核处理更快地运行glm功能 [英] How can I use multi cores processing to run glm function faster
问题描述
我对r有点陌生,我想使用一个允许多核处理的包,以便更快地运行glm函数.我想知道是否有可以用于此问题的语法. 这是我编写的示例glm模型,可以添加将使用多核的参数吗?
I'm a bit new to r and I would like to use a package that allows multi cores processing in order to run glm function faster.I wonder If there is a syntax that I can use for this matter. Here is an example glm model that I wrote, can I add a parameter that will use multi cores ?
g<-glm(IsChurn~.,data=dat,family='binomial')
谢谢.
推荐答案
我使用speedglm,结果非常好:使用glm,我花了14.5秒获得结果,而使用speedglm,我花了1.5秒.改进了90%.代码非常简单:m <- speedglm(y ~ s1 + s2,data=df)
.只是不要忘记安装并调用该软件包.另一个问题:不能将所有变量都与."一起使用speedglm无法将点识别为所有变量".
I used speedglm and the results are very good: using glm it took me 14.5 seconds to get results and with speedglm it took me 1.5 sec. that a 90% improvement..the code is very simple: m <- speedglm(y ~ s1 + s2,data=df)
. Just don't forget to install and call the package. Another issue: you can't use all variables with "." the speedglm does not recognize the dot as "all variables".
这篇关于如何使用多核处理更快地运行glm功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!