Skip to content

Problems parallelizing glmnet

4 messages · Patrik Waldmann, Zachary Mayer, Simon Urbanek

#
Hasn't the caret package already solved this problem?

You can pass the tuneGrid parameter to specify your custom alpha and
lambda sequence, an the trainControl parameter to specify what kind of
cross-validation you wish to use.

Caret uses foreach, so you can register a parallel backend of your choice.

Sent from my iPhone
On Sep 6, 2012, at 11:56 AM, Patrik Waldmann <patrik.waldmann at boku.ac.at> wrote:

            
#
On Sep 6, 2012, at 11:50 AM, Patrik Waldmann <patrik.waldmann at boku.ac.at> wrote:

            
You're evaluating exactly the same expression on all nodes ... I don't think you intended that (you are passing the alphasplit list as alpha to all of them - I don't think that makes sense). Isn't this closer to the intention:

alphas <- seq(0, 1, length.out= cores)
out <- clusterApply(cl, alphas, function(alpha) cv.glmnet(x,y,alpha=alpha))

Cheers,
Simon