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

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 detai1s

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!