Closed oakniiv closed 6 years ago
This happens when you don't have a file of the youngest year in train_years. You have to either download files (and reshape them) or adjust train_years at around L44.
Downloaded whole data from 2000 to 2018 for EUR/USD reshaped it and it still happens, where do I adjust train_years?
train_years can be configured at L44
could you insert print('I got data',datanow.exist_data)
after datanow.loaddata(train_year,month,i)
in
for train_year in train_years:
for month in range(1,13):
for i in range(0,1000):
datanow.loaddata(train_year,month,i)
around L91
with correct indentation and tell me the output?
I think the data files are not in the correct directory. What it is complaining is that class
of tradedata
in data_util.py
is not loading data.
There should be the following two lines at around Line 11,
datadir = '../data/tickdata/twosecdata/'
fname=datadir+'data'+str(year) + "-" + str(month).zfill(2) + "-" + str(i).zfill(4)+".out"
you can check to see if the file, fname
, exists.
I made it work, I simply copied "currepsilon = greed0*np.exp(-numlearns/gamma_epsilon)" on an empty line at the beginning of the code therefore defined what currepsilon is, thank you for you time. May I contact you via email I'd like to talk about binary option itself since I am already a trader I have many strategies and ideas for machine learning?
You can send an e-mail to t.hashizume.brisbane@gmail.com
so its fixed?
I also pushed a workaround.
I think the bug appears when the January of the first year doesn't contain any data (or the usable amount of data). Hope it helped.
I made a lot of progress, installed bash for windows made a lot of progress actually, now I have problems installing geckodriver to path to run demotrade_tf.py but that is not important now I'll figure it out. I want to ask about the data, I still can't get it to learn anything, what did you mean with this code I sent you in the picture? Are those folders I should change and put the data in there? How to install those "dependecies" As I understood you made those or?
On 13 January 2018 at 23:08, Tom notifications@github.com wrote:
You can send an e-mail to t.hashizume.brisbane@gmail.com so its fixed? I also pushed a workaround.
I think the bug appears when the January of the first year doesn't contain any data (or the usable amount of data). Hope it helped.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/zoome0215/predictBO/issues/2#issuecomment-357471061, or mute the thread https://github.com/notifications/unsubscribe-auth/Agh4WVsT3rwgIOxzKsEZu0sBmUKSY5TUks5tKSlygaJpZM4RbkBO .
Is it possible for you to post a screenshot of some of the files in the /data folder?
Dependencies can be install using pip, (pip3, pip2.7 the number depends on what version of python you are using). If you can go beyond the initial loading scheme (lines resemble from *** import ***
) you should be fine.
also it is great to hear that you are making progress!
here, after that it runs the ai and says learned 0 times over and over again
On 19 January 2018 at 22:14, Tom notifications@github.com wrote:
Is it possible for you to post a screenshot of some of the files in the /data folder?
Dependencies can be install using pip, (pip3, pip2.7 the number depends on what version of python you are using). If you can go beyond the initial loading scheme (lines resemble from import ) you should be fine.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/zoome0215/predictBO/issues/2#issuecomment-359090614, or mute the thread https://github.com/notifications/unsubscribe-auth/Agh4WYE0aNxE85ox3VANUXzSWwAki-54ks5tMQWbgaJpZM4RbkBO .
I also put the data from USD/JPY back, re downloaded makeai, I did everything how it says in readme, and still it's not learning anything
On 20 January 2018 at 10:51, oakniiv mainoakniiv@gmail.com wrote:
here, after that it runs the ai and says learned 0 times over and over again
On 19 January 2018 at 22:14, Tom notifications@github.com wrote:
Is it possible for you to post a screenshot of some of the files in the /data folder?
Dependencies can be install using pip, (pip3, pip2.7 the number depends on what version of python you are using). If you can go beyond the initial loading scheme (lines resemble from import ) you should be fine.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/zoome0215/predictBO/issues/2#issuecomment-359090614, or mute the thread https://github.com/notifications/unsubscribe-auth/Agh4WYE0aNxE85ox3VANUXzSWwAki-54ks5tMQWbgaJpZM4RbkBO .
Not sure if you got the pictures from the mail above I sent idk if it was delivered the files may be big
On 21 January 2018 at 10:50, oakniiv mainoakniiv@gmail.com wrote:
I also put the data from USD/JPY back, re downloaded makeai, I did everything how it says in readme, and still it's not learning anything
On 20 January 2018 at 10:51, oakniiv mainoakniiv@gmail.com wrote:
here, after that it runs the ai and says learned 0 times over and over again
On 19 January 2018 at 22:14, Tom notifications@github.com wrote:
Is it possible for you to post a screenshot of some of the files in the /data folder?
Dependencies can be install using pip, (pip3, pip2.7 the number depends on what version of python you are using). If you can go beyond the initial loading scheme (lines resemble from import ) you should be fine.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/zoome0215/predictBO/issues/2#issuecomment-359090614, or mute the thread https://github.com/notifications/unsubscribe-auth/Agh4WYE0aNxE85ox3VANUXzSWwAki-54ks5tMQWbgaJpZM4RbkBO .
Did you checkout the minimum.zip I sent you over the e-mail? I think you need them? Everything must be organised as how it is.
and I can't see the picture.
Today I re-downloaded makeAI-tf.py and put USD/JPY data and still it wouldn't work
ah okay. at Line 44
in make-AI.py
there is
train_years = range(2014,2017)
change it to
train_years = range(2017,2018)
Right now your data folder (data/tickdata/truncateddata
) has data from only 2017.
This is not good, because you want to test it on data from 2017
using the data from the years previous to 2017
I put the USD/JPY data back, from 2014 01 to 2018 01, changed train_years to 2014 to 2018
it is still not learning anything
makeAI-tf.py ""
from future import division
import numpy as np import os, os.path import sys import time from datetime import datetime import pickle
import matplotlib matplotlib.use("tkagg") import matplotlib.pyplot as plt
import data_util import learning_util
upparam = 1 downparam = -1 restparam = 0
############################# cont_learn = False
interval = 15 # min betinterval = 5 # min periodint = 2
outname = 'realuod'+str(interval)+''+str(betinterval)+'_tf'
target_rate = 4 # per hour payrate=2 initmoney = 200 bet = 20
lr0 = 0.000001 greed0= 1.0
lrthresh = 1e-8 epsthresh = 1.0/15.0
gamma_epsilon = 100000.0 #Decay rate : epsilon = greed0 * exp(- numlearns / gamma_epsilon)
train_years = range(2014,2018) Nepochs = 100000000
wait = 5 #min
possibleactions = (downparam,restparam,upparam)
weightactions = np.array([1/3,1/3,1/3])
if betinterval < 10 : payrate = 1.85
gain = bet*(payrate-1)
print 'tested on', datetime.today() print 'interval of ' , interval ,' min'
interval = int(interval60/periodint) betinterval = int(betinterval60/periodint) wait = int(wait*60/2)
outdir = '../AI/tf/' outname = outdir+outname
learner = learning_util.learn(outname,lr0,possibleactions,weightactions,interval)
datanow = data_util.tradedata()
if cont_learn: print 'AI loaded!' learner.loadmodel(); learner.loadtargetmodel(); else: print 'Making a new AI!'
numdata=0 numtrials = 0 numlearns = 0
currepsilon=0
moneynow=initmoney e = 0 while e < Nepochs : if e%100 ==0: print 'epoch ', e for train_year in train_years: for month in range(1,13): for i in range(0,1000): datanow.loaddata(train_year,month,i) if (not datanow.exist_data) : break jlim = datanow.size()-(interval+max(betinterval,wait)) if jlim > (wait+interval): currepsilon = greed0*np.exp(-numlearns/gamma_epsilon)
if currepsilon < epsthresh :
currepsilon = epsthresh
learner.set_epsilon(currepsilon)
numdata+=jlim
j=0
while j < jlim :
datnowall = datanow.get(j,interval+max(betinterval,wait))
state = datnowall[:interval]
diff_io = state[-1]-datnowall[interval+betinterval-1]
state = data_util.scaling(state)
action = learner.select_action(state, learner.exploration)
reward = data_util.calcreward(action,diff_io,bet,gain)
if action == 0:
statenext = datnowall[1:interval+1]
else :
statenext = datnowall[wait:(interval+wait)]
moneynow+= reward
if moneynow < 0:
terminal=True
moneynow = initmoney
elif moneynow > initmoney:
terminal=False
moneynow = initmoney
else :
terminal=False
statenext = data_util.scaling(statenext)
learner.storeexperience(state,action,reward,statenext,terminal)
if (numtrials%(60*60*1/periodint)) == 0:
learner.experience_replay()
numlearns+= 1
if action == 0:
j+= 1
else :
j+=wait
numtrials += 1
print train_year,month, i, 'learned', numlearns,'times with epsilon =',currepsilon
learner.saveall()
e += 1
""
Did you change anywhere else in make-AI.py
?
You have to have the data from 2014
and on wards in data/truncateddata/
and has to have a format of data``year-month.txt
so basically, you have csv
files in
data/rawdata/
folder in a form of DAT_NT_USDJPY_T_LAST_yearmonth.csv
those will be reshaped by running shapedata/truncatenight.py
. The output of this should be in a form of datayear-month-number.out
in data/twosecdata/. the output of that python script will be re-shaped further by running
shapedata/shapetwosec.py. Output will be in
data/truncateddataand has a form of
datayear-month.txt`.
I have no idea what's wrong with it. There are so many things you could've changed and caused a bug (like changes in any of the python scripts mentioned above could end up making wrong output files).
It is impossible to identify what is causing it. I'm sorry...
Also, it seems that your truncatenight.py
is not working.
Right now I am outputting data with truncatenight i'll try running the whole thing again
On Jan 21, 2018 12:04 PM, "Tom" notifications@github.com wrote:
Also, it seems that your truncatenight.py is not working.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/zoome0215/predictBO/issues/2#issuecomment-359240113, or mute the thread https://github.com/notifications/unsubscribe-auth/Agh4WU0yTE_t34FadZw-l3hfIF1zbvWBks5tMxmugaJpZM4RbkBO .
You should delete all the files in data
(delete only the files. not the folders!) except for the ones in data/rawdata
.
Everything is how it's supposed to be now
still not learning
did you try executing the files in minimum.zip
that I sent you via e-mail and dropbox
few days ago? did it work?
also, could you also put the screenshot of the output of make-AI.py
?
I have no clue why its not working on your machine (it might be because you have a windows machine.).
I replaced files in the folder with those from minimum, I don't have minimum.zip anymore, I'm using bash so the project is using linux ubuntu
https://www.dropbox.com/s/2s6a9ijasqh063z/minimum.zip file not there anymore
data_util.py line12 is correct? is it supposed to say .out or .txt? i tried with .txt did not work tho
No, you don't have any data in data/twosecdata/
that's the problem.
then it is shapetwosec.py making all this trouble?
could be. Did you run it?
holy shit it is running, first I ran truncated as it should be, now I went back and ran just shapetwosec and I think it is running right now
before I ran them together in one command
alright hahaha that's good to hear!
Please write exactly what you did wrong and what you did to fix it so that I can update the read me for other people who might encounter the similar problem!
Thanks!
First you have to run truncatenight.py and once you have those files in the folder then run the shapetwosec.py
and if changing currency make sure to modify truncatenight.py line 12 to match the file name
and could you please write a tutorial once we are done training the ai x times, what then? where is the file stored with all the trained data? how to use it where to put it?
also, once i train it for a little bit, can i save the training, load it again and add more data to it?