I have a dataset consisting of 2000 sequences of 3 numbers, ranging from 1 to 50 (for example, (2,11,35) or (8,20,49)). The data is in a .csv file, which R reads as a dataframe - 2000 obs. of 3 variables, all intergers.
I want to convert the data into a 3d array of 'frames', where every frame consists of the last 25 sequences. A keras model with 2d conv layers will then learn to predict the 26th sequence.
I tried loading the dataset using as.matrix(read.csv())
, and then
x<-dataset[1:25,]
for (i in 2:(nrow(dataset)-24)) {
x<-rbind(x, dataset[i:(i+24),])
}
x<-array_reshape(x,c(1976,25,3,1))
The data seems to come out with the correct shape, but when I compare it with the original I see that the numbers are all out of order. Using dim()
also did not help.
Could anyone please help?