I was doing some stuff with the package starting with the rnn-Vignette and found a very minor issue in that document.
I was trying to execute the example calculation and found that contrary to the code in the Vignette, the function int2bin(integer, length=time_dim) needs a second argument; in the Vignette it is left out.
Here is the relevant, "broken" code so you can check it yourself:
library(rnn)
set.seed(1)
# create sample inputs
X1 = sample(0:127, 5000, replace=TRUE)
X2 = sample(0:127, 5000, replace=TRUE)
# create sample output
Y <- X1 + X2
# convert to binary
#### should return an error here
X1 <- int2bin(X1)
X2 <- int2bin(X2)
Y <- int2bin(Y)
# Create 3d array: dim 1: samples; dim 2: time; dim 3: variables.
X <- array( c(X1,X2), dim=c(dim(X1),2) )
Y <- array( Y, dim=c(dim(Y),1) )
model <- trainr(Y=Y[,dim(Y)[2]:1,,drop=F], # we inverse the time dimension
X=X[,dim(X)[2]:1,,drop=F], # we inverse the time dimension
learningrate = 0.1,
hidden_dim = 10,
batch_size = 100,
numepochs = 10)
Hi,
I was doing some stuff with the package starting with the rnn-Vignette and found a very minor issue in that document. I was trying to execute the example calculation and found that contrary to the code in the Vignette, the function
int2bin(integer, length=time_dim)
needs a second argument; in the Vignette it is left out. Here is the relevant, "broken" code so you can check it yourself: