TimoMatzen / RBM

Restricted Boltzmann Machine in R
29 stars 9 forks source link

Error in `[<-`(`*tmp*`, , 12, value = 0) : subscript out of bounds #4

Open tare99 opened 6 months ago

tare99 commented 6 months ago

There seems to be an issue I can't figure out how to fix when I use the predict functions for RBM and StackedRBM models.

Error in [<-(*tmp*, , 12, value = 0) : subscript out of bounds

I'm using these two methods Classification RBM modClassRBM <- RBM(x = x_train_scaled, y = y_train, n.iter = 1000, n.hidden = 100, size.minibatch = 10) Stacked RBM modStackSup <- StackRBM(x = x_train_scaled, y = y_train, layers = c(100, 100, 100), n.iter = 1000, size.minibatch = 10)

After this, I use Predicting RBM PredictRBM(test = x_test_scaled, labels = y_test, model = modClassRBM) Predicting Stacked RBM PredictRBM(test = x_test_scaled, labels = y_test, model = modStackSup, layers = 3)

And it fails on both methods with the error.

Interesting thing is that when I use the DBN functions, everything is fine.

x_train_scaled and y_train have exactly the same number of rows. I was initially thinking that it could be a problem of the two mismatch so the index gets out of bounds.

Other thing I've noticed is when I use the data("name of dataset") method, it returns that there was no dataset with that name found, which doesn't do for the MNIST dataset which works perfectly and does not throw the out of bounds error.

I'm sure that the data I use is fine and there are no blank or NA values in it.

tare99 commented 6 months ago

There is also a case on the DBN method where it throws

Error in [<-(*tmp*, i, labels[i] + 1, value = 1) : subscript out of bounds

modDBN <- DBN(x = x_train_scaled, y = y_train, n.iter.pre = 100, n.iter = 100, nodes = c(100,100), size.minibatch = 10)

It throws the same error using the RBM functions.

There seems to be nothing unusual with the data that I could connect with this problem.