What’s my mistake in layering this LSTM? (Keras, R)

  Kiến thức lập trình
    # DEFINE THE LSTM MODEL
    #input_shape <- c(52.0, 5.0)
    #input_shape = c(seq_length, ncol(close_data))
    #layer_input(shape = input_shape) %>%

    model <- keras_model_sequential() %>%
      layer_lstm(units = 50, return_sequences = TRUE, 
             input_shape = c(52, 5)) %>%
      layer_lstm(units = 50) %>%
      layer_dense(units = 1)

the code above keeps yielding this error:

Error in py_call_impl(callable, call_args$unnamed, call_args$named) : 
  ValueError: Only input tensors may be passed as positional arguments. The following argument value should be passed as a keyword argument: <Sequential name=sequential_1, built=False> (of type <class 'keras.src.models.sequential.Sequential'>)

if you notice, I tried to do ‘input_shape’ in multiple different ways, as shown by the comments at the start.

This is my first time working with neural networks and I have no idea whats going wrong. For reference, I want to use a timestep of 52, and I have 5 features. I’ve modified the code in many other ways that yielded way too many errors to put in one post. I’ve also configured, re-configured, re-installed, and completely changed the python environment that I was using. (I started off using a virtual environment with ‘r-reticulate’ and eventually switched to a conda env(with all the right dependencies installed.

ANY guidance would be appreciated.

I put all of the stuff in this section in the section above. sorry its also my first time using stack overflow.

New contributor

user15931110 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT