Hey guys, so I am building a neural network for sentiment analysis. Basically I have a json file I convert to a data frame. There are 3 columns. 1 is the rank 1-5. 2 is review text which is words reviewing a product. 3. Is a summary of the review text. I need a loss and accuracy function to predict this. I have tried to tokenize my data and create a vocabulary list then run it through a keras_model to compile and plot. If anyone could help me debug my code, that would be awesome.
num_words <- 10000 max_length <- 50 text_vectorization <- layer_text_vectorization( max_tokens = num_words, output_sequence_length = max_length, ) text_vectorization %>% adapt(train$reviewText) get_vocabulary(text_vectorization) text_vectorization(matrix(train$reviewText, ncol = 1)) input <- layer_input(shape = c(1), dtype = "string") output <- input %>% text_vectorization() %>% layer_embedding(input_dim = num_words + 1, output_dim = 16) %>% layer_global_average_pooling_1d() %>% layer_dense(units = 16, activation = "relu") %>% layer_dropout(0.5) %>% layer_dense(units = 1, activation = "sigmoid") %>% input_shape = train_matrix.shape model <- keras_model(input, output) model %>% compile( optimizer = 'adam', loss = 'binary_crossentropy', metrics = list('accuracy') ) summary(model) history <- model %>% fit( train_matrix, epochs = 10, batch_size = 5, validation_split = 0.2, ) plot(history)