lstm

LSTM train data resample

LSTM train data resample Question: I try train LSTM model with time series data. If I load it as they are everything is ok. Model work with good accuracy and loss function. But if I resample it for example 1H or 24H it stop work. Accuracy drops extremely down and lost function is nan Epoch …

Total answers: 1

How do I correctly use LSTM model to make prediction?

How do I correctly use LSTM model to make prediction? Question: I have following setup: x,y=load_data_xy("file",[<input headers>],[<target headers>]) b_size=1024 history_length=100 data_gen = TimeseriesGenerator(x.to_numpy(), y.to_numpy(), shuffle=True, length=history_length, batch_size=b_size) later, I create and train the lstm model, and than, I want to evaluate original data with the model. Here’s what I’m doing: data_gen = TimeseriesGenerator(x.to_numpy(), y.to_numpy(), length=history_length, …

Total answers: 1

ValueError: Found array with dim 3. Estimator expected <= 2. Raise value error while I use scaler.inverse_transform()

ValueError: Found array with dim 3. Estimator expected <= 2. Raise value error while I use scaler.inverse_transform() Question: I’m trying to implement this code to predict a future stock price. The code seems to work well the error raise while I run the last line of the code: predicted_stock_price = scaler.inverse_transform(predicted_stock_price) Below I add the …

Total answers: 1

Keras LSTM – looping over variable sequence length

Keras LSTM – looping over variable sequence length Question: I want to manually loop over the varying sequence lengths of the input sequences but Tensorflow automatically makes the time axis to None after noticing varying sequence lengths. Is there any work around for this? Sample example import tensorflow as tf import numpy as np class …

Total answers: 1

Why does my LSTM model predict wrong values although the loss is decreasing?

Why does my LSTM model predict wrong values although the loss is decreasing? Question: I am trying to build a machine learning model which predicts a single number from a series of numbers. I am using an LSTM model with Tensorflow. You can imagine my dataset to look something like this: Index x data y …

Total answers: 4

ImportError: dlopen(…): Library not loaded: @rpath/_pywrap_tensorflow_internal.so

ImportError: dlopen(…): Library not loaded: @rpath/_pywrap_tensorflow_internal.so Question: I am a beginner at machine learning. I try to use LSTM algorism but when I write from keras.models import Sequential it shows error as below: ImportError: dlopen(/Users/wangzifan/opt/anaconda3/lib/python3.9/site-packages/tensorflow/python/_pywrap_tfe.so, 2): Library not loaded: @rpath/_pywrap_tensorflow_internal.so Referenced from: /Users/wangzifan/opt/anaconda3/lib/python3.9/site-packages/tensorflow/python/_pywrap_tfe.so Reason: image not found How can I fix this? Thank you so …

Total answers: 2

ValueError: Input 0 of layer "lstm" is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, 1024)

ValueError: Input 0 of layer "lstm" is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, 1024) Question: I was following Transfer learning with YAMNet for environmental sound classification tutorial. Here is the link: https://www.tensorflow.org/tutorials/audio/transfer_learning_audio In the tutorial, they defined a Sequential model with one hidden layer and two outputs to recognize …

Total answers: 2

How would one use a RNN when predicting temperature?

How would one use a RNN when predicting temperature? Question: Let’s assume I have a dataframe with several features, like humidity, pressure, and so on. One of these columns, would be temperature. At each row, I have the data for one day. I would like to predict the temperature for the next day, with past …

Total answers: 1

Forecast future values with LSTM in Python

Forecast future values with LSTM in Python Question: This code predicts the values of a specified stock up to the current date but not a date beyond the training dataset. This code is from an earlier question I had asked and so my understanding of it is rather low. I assume the solution would be …

Total answers: 2

ValueError: Shape must be at least rank 3 but is rank 2 for '{{node BiasAdd}} = BiasAdd[T=DT_FLOAT, data_format="NCHW"](add, bias)' with input shapes:

ValueError: Shape must be at least rank 3 but is rank 2 for '{{node BiasAdd}} = BiasAdd[T=DT_FLOAT, data_format="NCHW"](add, bias)' with input shapes: Question: Done I am just trying to run and replicate the following project: https://machinelearningmastery.com/time-series-prediction-lstm-recurrent-neural-networks-python-keras/ . Basically until this point I have done everything as it is in the linked project but than I …

Total answers: 3