I need getting the predicted values out of my LSTM model in my trading bot, I think the problem is inverting the scaled value
I am currently making a trading bot using python. And i have almost completed the LSTM model, but i have trubble getting the predicted next closing prices. In my X_train i am using 8 different features.
My code is very simular to this one: https://drive.google.com/file/d/15xlgoTsoLsV9I6mDtaUEw-EMyd1lq6tp/view?usp=sharing
It seems like the problem accures when i try to invert the scaled y values so i can acually understand what the value means.
I've asked gpt for hours with no help, and look at yt as well
invert scaling: next_value = sc.inverse_transform(y_pred[-1])
ValueError Traceback (most recent call last) in <cell line: 1>() ----> 1 next_value = sc.inverse_transform(y_pred[-1])
1 frames /usr/local/lib/python3.9/dist-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, estimator, input_name) 900 # If input is 1D raise error 901 if array.ndim == 1: --> 902 raise ValueError( 903 "Expected 2D array, got 1D array instead:\narray={}.\n" 904 "Reshape your data either using array.reshape(-1, 1) if "
ValueError: Expected 2D array, got 1D array instead: array=[0.699612]. Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
Comments
Post a Comment