Question
I am trying to code a BiLSTM in R, and keep getting this issue. Is there a way to fix it? Below is the code
I am trying to code a BiLSTM in R, and keep getting this issue. Is there a way to fix it? Below is the code I have so far:
After the padding the dimensions of each of the _train variables are 1 2114, and all of the _test variables are 1 529, if that helps. This is for stock data, so I anticipate the accuracy measure needs to change as well.
bilstm_mod % layer_embedding(input_dim = 2115, output_dim = 2115) %>% bidirectional(layer_lstm(units = 32, dropout = 0.4, recurrent_dropout = 0.4)) %>% layer_dense(units = 2115, activation = "sigmoid")
bilstm_mod %>% compile( optimizer = "adam", loss = "binary_crossentropy", metrics = c("accuracy") )
Index
x_train
bilstm_mod %>% fit( x_train, y_train_rm, batch_size = 2115, epochs = 4, validation_data = list(x_test, y_test_rm) )
Error in py_ca11_imp1(ca11ab1e, dots\$args, dots\$keywords) : ValueError: in user code: 1oss_value = 1oss_obj (yt,yp, sample_weight=sw) losses = ca.11_fn(y_true, ypred ) return ag_fn(y_true, ypred, =self._fn_kwargs) backend.binary_crossentropy(y_true, y_pred, from_logits=from_logits), return tf.nn.sigmoid_cross_entropy_with_logits ( ValueError: "Togits" and "Tabels" must have the same shape, received ((None, 2115) vs (None, 2114)). See "reticulate::py_1ast_error()" for detai1sStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started