llSourcell / Reinforcement_Learning_for_Stock_Prediction

This is the code for "Reinforcement Learning for Stock Prediction" By Siraj Raval on Youtube
641 stars 363 forks source link

functions.py", line 20, in sigmoid return 1 / (1 + math.exp(-x)) OverflowError: math range error #14

Open Kalelv45 opened 6 years ago

Kalelv45 commented 6 years ago

I'm trying to use this model to make it run on other dataset as well. I have created another dataframe with the exact same numbers of columns (same name as well). But when I try to run it I always get this error: File "/Users/Desktop/Reinforcement_Learning_for_Stock_Prediction-master/functions.py", line 20, in sigmoid return 1 / (1 + math.exp(-x)) OverflowError: math range error

I tried everything, round all the columns to no float. Just don't understand what can be the problem

yeshengyi commented 6 years ago

math.exp(-x) when x is -710 or smaller this will show the error....

xtr33me commented 6 years ago

I've issued a pull request for some of the issues I ran into on this project but they have yet to be merged. For the time being, feel free to check out my fork here which has a simple fix for this: https://github.com/xtr33me/Reinforcement_Learning_for_Stock_Prediction

Kalelv45 commented 6 years ago

Thanks, I'll check it out!

Kalelv45 commented 6 years ago

There is any particolar reason of why this is running so slow. I tried to remove many date from the data samples (leaving only the days where BTC was above 1000$), yet to do 1000 ep will take me about 3 days.

lorenzo-caruso commented 5 years ago

functions.txt

To solve this issue use this file. Simply rename it from .txt to .py