x4nth055/pythoncode-tutorials

Stock-prediction,

tomMEM opened this issue · 4 comments

Hello, thank you for all the scripts and great work.
I tried Stock-prediction and stucked at the last Cell with :

----> mean_absolute_error = data["column_scaler"]["adjclose"].inverse_transform(mae.reshape(1, -1))[0][0]
print("Mean Absolute Error:", mean_absolute_error)
# predict the future price

AttributeError: 'float' object has no attribute 'reshape'

How can it be solved?
In addition, I wonder how to speed up the calculations - so far it takes couple of hours.
All the best

Hey there,

I think you need to pull the latest version of the tutorial, or you can get it from here:
https://github.com/x4nth055/pythoncode-tutorials/blob/master/machine-learning/stock-prediction/

I have updated the tutorial a while ago to not reshape the float object.

I hope this solved your issue, please confirm.

Regards,
Rockikz

Hello, thank you for the message. I tried a fresh repository copy but got the same error, but it seems not to be important for the final plots. All the best, T

You can manually copy the code, I can confirm that the reshape() is no longer there.

I will update the tutorial furthermore to make it less confusing for beginners.

Thank you!

Thank you for your fast response. I took now the py scripts and not the jupyter notebook - works well. Thx for the tutorials. Best.