You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the Neat algorithm to build a day trading bot, I'm using market data (2800 days worth) but getting a little stuck on how to correctly train. The market data contains the date and price. I make sure the neural network stays small enough to prevent over-fitting.
The first part of the problem:
If I just calculate the score with all the raw data and then evolve (1 cycle); the model is good for that whole set of data. When using the model, you have to start on day one. If you start on day 10/etc, the model breaks.
So I modified the model so after each cycle, it increases the starting day by one and then starts again at one when it's on the last day. But once it starts again (day one) the model breaks in training. It has had too many mutations and no longer can do the beginning.
So I modified the model so it would only evolve when the starting point starts again (day one) i.e after its going through the data 3921400 (2800+2799+...) times. But doing it this way seems like it would take forever. It seems to get stuck too easily.
What is the best way to solve this kind of problem? I'm guessing that I need to shuffle the data somehow? But what is the correct way?
2nd part of the problem:
I was lucky and got a genome that worked good enough without the 3rd modifications. But when I used the testing data, it failed badly.
Here is some of the code that might help understand my problem.
functionlearnData(){constdataLength=trainingSet.length;letlearnLoops=0;while(true){for(leti=learnLoops;i<dataLength;i++){constdata=trainingSet[i];for(letj=0;j<bots.length;j++){constbot=bots[j];bot.update(data[0],data[1],data[2],data[3],data[4]);}}learnLoops++;if(learnLoops+10>=dataLength){//Reset the looplearnLoops=0;endEvaluation();}//Save some cycles by reusing the bot objects. for(leti=0;i<neat.population.length;i++){bots[i].reset(neat.population[i]);}}console.log("Finished learning.");}classBot{update(dayInMonth,monthInYear,tokenPrice,tokenPriceChange,runningAveragePriceChange){//This genome is bad so penalise every day it has missed.if(this.stop||this.shouldRemove(this.day)){this.genome.score-=1000;this.stop=true;return;}constnormalisedData=this.normaliseData(dayInMonth,monthInYear,tokenPriceChange,runningAveragePriceChange);constoutput=this.genome.activate(normalisedData);consttrade=output[0];if(trade!==0){if(trade>0.5&&this.token>0){this.usd=this.token*tokenPrice-0.16;this.token=0;}elseif(trade<=0.5&&this.usd>0){constbuyingToken=this.usd/tokenPrice;constfee=buyingToken*.03;this.token=buyingToken-fee;this.usd=0;}}this.bankInUsd=(this.token*tokenPrice)+this.usd;this.genome.score+=this.bankInUsd/this.day;}}
The text was updated successfully, but these errors were encountered:
dan-ryan
changed the title
What is the ideal way to train a lot of data with Neat.
What is the ideal way to train a lot of data with the Neat algorithm.
Mar 31, 2018
I'm using the Neat algorithm to build a day trading bot, I'm using market data (2800 days worth) but getting a little stuck on how to correctly train. The market data contains the date and price. I make sure the neural network stays small enough to prevent over-fitting.
The first part of the problem:
If I just calculate the score with all the raw data and then evolve (1 cycle); the model is good for that whole set of data. When using the model, you have to start on day one. If you start on day 10/etc, the model breaks.
So I modified the model so after each cycle, it increases the starting day by one and then starts again at one when it's on the last day. But once it starts again (day one) the model breaks in training. It has had too many mutations and no longer can do the beginning.
So I modified the model so it would only evolve when the starting point starts again (day one) i.e after its going through the data 3921400 (2800+2799+...) times. But doing it this way seems like it would take forever. It seems to get stuck too easily.
What is the best way to solve this kind of problem? I'm guessing that I need to shuffle the data somehow? But what is the correct way?
2nd part of the problem:
I was lucky and got a genome that worked good enough without the 3rd modifications. But when I used the testing data, it failed badly.
How would do I do some kind of cross-validation?
Example of the data:
Code
Here is some of the code that might help understand my problem.
The text was updated successfully, but these errors were encountered: