Question: I am trying to code a BiLSTM in R, and keep getting this issue. After the padding the dimensions of each of the _train variables

 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. 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. Is there a way to fix it? Below is the code I have so far:

library(tsibble) library(tidyquant) library(qpcR) library(dplyr) library(MASS) library(ggplot2) library(readxl) library(TSA) library(alr4) library(stats) library(lme4) library(tseries) library(reticulate) library(readxl) library(TSLSTM) library(keras) library(tensorflow) library(forecast) library(stats) # use_condaenv("r-tensorflow") use_python("C:/Users/zacha/anaconda3") #Importing data into R. Scraped this using Python's yfinance library O_data

ACC1

bilstm_mod % layer_embedding(input_dim = 2114, output_dim = 2115) %>% bidirectional(layer_lstm(units = 2114, dropout = 0.4, recurrent_dropout = 0.4)) %>% layer_dense(units = 2114, 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 = 2114, epochs = 4, validation_data = list(x_test, y_test_rm) )

bilstm_mod %>% evaluate(x_train, y_train_rm) bilstm_mod %>% evaluate(x_test, y_test_rm)

Error in py_ca11_impl(ca117able, dots\$args, dots $keywords ) : tensorflow. python.framework. errors_imp 1. InvalidArgumentError: Graph execution error: utputs = node. 7ayer("args, *"kwargs) return fn("args, "*kwargs) outputs = ca11_fn(inputs, "args, "*kwargs) return fn("args, =kwargs) out =tf.nn. embedding_lookup(self. embeddings, inputs) Node: 'sequentia1_7/embedding_7/embedding_lookup' indices [0,2113]=2114 is not in [0,2114 ) [[\{\{node sequentia1_7/embedding_7/embedding_lookup\} }]] [Op:__inference_train_function_44404] See "reticulate::py_7ast_error()" for details

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!