BLNNdevs / BLNN

Bayesian Learning for Neural Networks
GNU General Public License v3.0
5 stars 7 forks source link

Error in parallel sampling of BLNN_Train() #13

Open noahmthomas-nmt opened 3 years ago

noahmthomas-nmt commented 3 years ago

I get "Error: ‘length(workers) == 1’ is not TRUE" in the following code:

library(BLNN)
data(iris)

targ<-matrix(0, nrow=nrow(iris), ncol=3)
lev<-as.factor(iris$Species)
for(i in 1:150){
  targ[i, lev[i]]<-1
}
names(targ)<-c("Set", "Ver", "Vir")

data<-cbind(iris$Sepal.Length,
            iris$Sepal.Width,
            iris$Petal.Length,
            iris$Petal.Width)
data<-scale(data)

ClassNet<-BLNN_Build(ncov=4, nout=3, hlayer_size = 3,
                     actF = "tanh",
                     costF = "crossEntropy",
                     outF = "softmax")

# Train
iter <- 1e4 
ClassNUTS <- BLNN_Train(NET = ClassNet,
                        x = data,
                        y = targ,
                        iter = iter,
                        warmup = iter * .8,
                        algorithm = "NUTS",
                        parallel = T,
                        display = 0, control = list(adapt_delta = 0.7,
                                                    lambda=.05,
                                                    stepsize=2,
                                                    gamma=5,
                                                    max_treedepth=15)

)

Not sure if this is an issue with my set up or the BLNN_Train() function.