HusseinJammal / Liquid-Neural-Networks-in-Stock-Market-Prediction

This repository hosts a stock market prediction model for Tesla and Apple using Liquid Neural Networks. It showcases data-driven forecasting techniques, feature engineering, and machine learning to enhance the accuracy of financial predictions.
Apache License 2.0
31 stars 7 forks source link

2nd date is processed from app before fully entered causing 400 on request to api.polygon.io #3

Closed lorenzmeis closed 2 months ago

lorenzmeis commented 2 months ago

Hi,

I get the setup running, but when I enter the second date, the app already takes the input when entering the first digit of a year leading to a 400 on the request to api.polygon.io. Adding a video to reproduce the error.

Br, Lorenz

https://github.com/HusseinJammal/Liquid-Neural-Networks-in-Stock-Market-Prediction/assets/12223628/06cafa24-85ca-4896-8838-8699476adac0

HusseinJammal commented 2 months ago

Hello,

It automatically takes the date as you type it in before entering all the digits of the year. There's a calendar icon inside the box (check the image below). You can select the date for now by clicking on this icon.

image

lorenzmeis commented 2 months ago

Thank you Hussein, this part is working fine now but on "Predict" I`m getting quite some errors. It could be related to the fact that my version of tensorflow is not the same you used for model training. Could you indicate which version you are using ?

Traceback (most recent call last): File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1498, in call return self.wsgi_app(environ, start_response) File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1476, in wsgi_app response = self.handle_exception(e) File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function return cors_after_request(app.make_response(f(*args, *kwargs))) File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1473, in wsgi_app response = self.full_dispatch_request() File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 882, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\flask_cors\extension.py", line 178, in wrapped_function return cors_after_request(app.make_response(f(args, kwargs))) File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 880, in full_dispatch_request rv = self.dispatch_request() File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 865, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(view_args) # type: ignore[no-any-return] File "C:\Users...\LNN\Liquid-Neural-Networks-in-Stock-Market-Prediction\app.py", line 315, in predict model = load_model('tesla_best_model_lnn_2 (1).h5') File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler raise e.with_traceback(filtered_tb) from None File "C:\Users...\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\optimizers\optimizer_experimental\optimizer.py", line 94, in _process_kwargs raise TypeError(f"{k} is not a valid argument, kwargs should be empty " TypeError: weight_decay is not a valid argument, kwargs should be empty for optimizer_experimental.Optimizer.

HusseinJammal commented 2 months ago

I'm using the version 2.11.0

lorenzmeis commented 2 months ago

Hi Hussein,

i got it running now with 2.11.0. ;-)

It is also important to set the model_path to an absolute path, so on Windows something like: model_path = 'C:\users\xxx\Liquid-Neural-Networks-in-Stock-Market-Prediction\tesla_best_model_lnn_2.h5' Maybe you could update the documentation as I assume that others will run in the same issue.

A last point: could you please share your code you used for the model training, I would like to add other tickers and timeframes, Open to share new models after.

Best regards, Lorenz