tudo-r / BatchJobs

BatchJobs: Batch computing with R
Other
85 stars 20 forks source link

question - stuck at batchMap #40

Closed GeoBer closed 10 years ago

GeoBer commented 10 years ago

I am trying to set up a BatchJobs job with 8 Scenarios. The function I use is a wrapper function that will put the parameters into their right form to call the functions that actually do the computing work. All parameters in the call are vectors of length 8, defined either as columns from matrices or vectors (created using rep). However, the function definition is not well interpreted: the message I get is-- Error in data.frame(fun_id = fun.id, pars = pars, jobname = jobname) : arguments imply differing number of rows: 1, 8, 0 FUNCTION DEFINTION BELOW preFixRes <- function(nRep, la01,la02,la03,la11,la12,la13,ct1,ct2,ct3, n,rho1,rho2,rho3,rho4,rho5, gamma1,gamma2,gamma3,gamma4,gamma5, optRho,optGamma,seeds, cLams){ n0 <- n/2 n1 <- n0 cttfs <- c(ct1,ct2,ct3) rho <- c(rho1,rho2,rho3,rho4,rho5) cLamb <- rep(cLams,3) gamma <- c(gamma1,gamma2,gamma3,gamma4,gamma5) rez <- runSimul (nRep,Scennr,la01,la02,la03,la11,la12,la13,ctffs, n0,n1,rho,gamma,optRho,optGamma,seeds, cLamb) resMat <- fixResTests1( rez,nRep,length(rho)) evs <- cEvs(rez,nRep) return(list(resMat=resMat,evs=evs)) } Question--what is being expected?

berndbischl commented 10 years ago

Hi,

1) What you should pass to batchMap should be clearly defined on the help page. If not, please say so.

2) In order to help you we would need a reproducible example so we can see how you actually call batchMap. Please post it.

3) general hint: There is testJob with the external = FALSE option. That allows you to see tracebacks.

GeoBer commented 10 years ago

Completion-- includes call to batchMap:

Scenario parameters go here

l11 <- c(.037,0.018,0.008) l21 <- c(0.0226,0.0137,0.0076) per1 <- c(2,3,5) l12 <- c(.038,0.025,0.008) l22 <- c(0.023,0.0186,0.0078) per2 <- per1 l13 <- c(.025,0.0146,0.013) l23 <- c(0.015,0.011,0.0105) per3 <- per1 l14 <- l11 l24 <- 0.7*l14 per4 <- per1 pMat0 <- matrix(rep(c(l11,l12,l13,l14),4),8,3,byrow=TRUE) pMat1 <- matrix(rep(c(l21,l22,l23,l24),4),8,3,byrow=TRUE) nd <- rep(c(3000,3200),each=4) rhov <- c(2,4,0,8,0 ) gammav <- c(0,0,2,0.1,0.5 )

seedz <- c(1374582,136859,25476,537280,1738540,647589,78492,345672) c1 <-rep(0.00035/3,8) rMat <- matrix(rep(rhov,8),8,5,byrow=TRUE) gMat <- matrix(rep(gammav,8),8,5,byrow=TRUE) nr <- rep(20,8) optR <- rep(2,8) optG <- rep(0,8) cp1 <- rep(c(per1[1],per2[1],per3[1],per4[1]),2) cp2 <- rep(c(per1[2],per2[2],per3[2],per4[2]),2) cp3 <- rep(c(per1[3],per2[3],per3[3],per4[3]),2) batchMap(reg1,preFixRes,nRep=nr, la01= pMat0[,1],la02=pMat0[,2], la03=pMat0[,3], la11 = pMat1[,1],la12 = pMat1[,2],la13 = pMat1[,3], ct1= cp1, ct2= cp2, ct3= cp3, n=nd,rho1=rMat[,1],rho2=rMat[,2],rho3=rMat[,3],rho4=rMat[,4], rho5=rMat[,5], gamma1=gMat[,1],gamma2=gMat[,2], gamma3=gMat[,3], gamma4=gMat[,4],gamma5=gMat[,5],optRho=optR,optGamma=optG, seeds=seedz, cLams=c1, use.names=TRUE )

GeoBer commented 10 years ago

Posted it as a comment – but I am including it again here: It is quite long because I have many parameters. I tried also batchExpandGrid and using more arguments but I am unsure about how the expansion works and it did not work.

Scenario parameters go here

l11 <- c(.037,0.018,0.008) l21 <- c(0.0226,0.0137,0.0076) per1 <- c(2,3,5) l12 <- c(.038,0.025,0.008) l22 <- c(0.023,0.0186,0.0078) per2 <- per1 l13 <- c(.025,0.0146,0.013) l23 <- c(0.015,0.011,0.0105) per3 <- per1 l14 <- l11 l24 <- 0.7*l14 per4 <- per1 pMat0 <- matrix(rep(c(l11,l12,l13,l14),4),8,3,byrow=TRUE) pMat1 <- matrix(rep(c(l21,l22,l23,l24),4),8,3,byrow=TRUE) nd <- rep(c(3000,3200),each=4) rhov <- c(2,4,0,8,0 ) gammav <- c(0,0,2,0.1,0.5 )

seedz <- c(1374582,136859,25476,537280,1738540,647589,78492,345672) c1 <-rep(0.00035/3,8) rMat <- matrix(rep(rhov,8),8,5,byrow=TRUE) gMat <- matrix(rep(gammav,8),8,5,byrow=TRUE) nr <- rep(20,8) optR <- rep(2,8) optG <- rep(0,8) cp1 <- rep(c(per1[1],per2[1],per3[1],per4[1]),2) cp2 <- rep(c(per1[2],per2[2],per3[2],per4[2]),2) cp3 <- rep(c(per1[3],per2[3],per3[3],per4[3]),2) batchMap(reg1,preFixRes,nRep=nr, la01= pMat0[,1],la02=pMat0[,2], la03=pMat0[,3], la11 = pMat1[,1],la12 = pMat1[,2],la13 = pMat1[,3], ct1= cp1, ct2= cp2, ct3= cp3, n=nd,rho1=rMat[,1],rho2=rMat[,2],rho3=rMat[,3],rho4=rMat[,4], rho5=rMat[,5], gamma1=gMat[,1],gamma2=gMat[,2], gamma3=gMat[,3], gamma4=gMat[,4],gamma5=gMat[,5],optRho=optR,optGamma=optG, seeds=seedz, cLams=c1, use.names=TRUE )

From: berndbischl [mailto:notifications@github.com] Sent: Freitag, 23. Mai 2014 10:52 To: tudo-r/BatchJobs Cc: Bermann, Georgina Subject: Re: [BatchJobs] question - stuck at batchMap (#40)

Hi,

1) What you should pass to batchMap should be clearly defined on the help page. If not, please say so.

2) In order to help you we would need a reproducible example so we can see how you actually call batchMap. Please post it.

3) general hint: There is testJob with the external = FALSE option. That allows you to see tracebacks.

— Reply to this email directly or view it on GitHubhttps://github.com/tudo-r/BatchJobs/issues/40#issuecomment-43985324.

berndbischl commented 10 years ago

Are you sure you wanted to close?

Have you figured out the problem?

mllg commented 10 years ago

You have triggered a bug in BatchJobs which is now fixed. You can either use the development version of BatchJobs or drop the argument use.names=TRUE in your call to batchMap.

GeoBer commented 10 years ago

No—I it was mistake I am not too good at handling the list

Georgina

From: berndbischl [mailto:notifications@github.com] Sent: Freitag, 23. Mai 2014 11:17 To: tudo-r/BatchJobs Cc: Bermann, Georgina Subject: Re: [BatchJobs] question - stuck at batchMap (#40)

Are you sure you wanted to close?

Have you figured out the problem?

— Reply to this email directly or view it on GitHubhttps://github.com/tudo-r/BatchJobs/issues/40#issuecomment-43987720.

GeoBer commented 10 years ago

I cannot find the buttons for opening and closing—it closed by itself: how do I reopen? Georgina

From: Michel [mailto:notifications@github.com] Sent: Freitag, 23. Mai 2014 11:41 To: tudo-r/BatchJobs Cc: Bermann, Georgina Subject: Re: [BatchJobs] question - stuck at batchMap (#40)

Closed #40https://github.com/tudo-r/BatchJobs/issues/40 via 8a16432https://github.com/tudo-r/BatchJobs/commit/8a164324157e4397f3ef4e2f9f55be5db9dfe4a1.

— Reply to this email directly or view it on GitHubhttps://github.com/tudo-r/BatchJobs/issues/40#event-124165245.

mllg commented 10 years ago

Wow this is a little bit chaotic :)

I think the issue is solved now. As already mentioned, you either need to wait for the next CRAN release for this bug to be fixed or use the development version. Alternatively, set use.names to FALSE or ensure that the first argument passed to batchMap is named.

Thanks for your report.

GeoBer commented 10 years ago

Yes –it worked dropping the use.names—thanks

Georgina

From: Michel [mailto:notifications@github.com] Sent: Freitag, 23. Mai 2014 11:55 To: tudo-r/BatchJobs Cc: Bermann, Georgina Subject: Re: [BatchJobs] question - stuck at batchMap (#40)

Wow this is a little bit chaotic :)

I think the issue is solved now. As already mentioned, you either need to wait for the next CRAN release for this bug to be fixed or use the development version. Alternatively, set use.names to FALSE or ensure that the first argument passed to batchMap is named.

Thanks for your report.

— Reply to this email directly or view it on GitHubhttps://github.com/tudo-r/BatchJobs/issues/40#issuecomment-43990693.