I need to create a dataset encoded with autoenceders.
The data set has 500 records as follows:
I have installed and loaded the following libraries:
I have divided my data set into two parts, training and test, with the holdout method:
Division <- holdout(y=Datos$recid)
where Datos is my dataset
I get the training and test data, removing the column that is the data that you want to predict:
- x_train <- subset(Datos[Division$tr,], select = -recid)
- x_test <- subset(Datos[Division$ts,], select = -recid)
Then I convert the data set to matrix (I do not know if this is necessary)
- x_train_matrix = data.matrix(x_train)
- x_test_matrix = data.matrix(x_test)
At this moment, what I want to do is the following:
- Define a coding model, with an input layer and the coding layer.
- Extract the encoded data, for later take this reduction of characteristics to use them in other training models
original_dim <- 7L #334L
encoding_dim <- 4L #32L
input_img <- layer_input(shape = c(original_dim))
encoded<- layer_dense(input_img,encoding_dim , activation = "relu")
autoencoder <- keras_model(input_img, encoded)
autoencoder %>% compile(optimizer = 'adadelta', loss = 'binary_crossentropy')
Am I on the right path?
I need help to achieve the goal I have tried to explain, I hope you help me.
Thank you very much