For NEURAL_TRAIN the Data parameter is a text string containing all samples in CSV format. The string can be stored in a temporary CSV file and then read by the machine learning algorithm for training the model.
Does Zorro append the new data on every bar, to a string?
Quote
... returned by the neural function; otherwise return 1 if no accuracy is calculated, or 0 for aborting the script when the training failed.
And by the way, 2.14 does not stop training if neural(mode = NEURAL_TRAIN) does return(0);
Last edited by laz; 08/19/1914:12.
Re: advise calls in TRAINMODE/TESTMODE slow
[Re: laz]
#477953 08/19/1912:0608/19/1912:06
I have now seen, that zorro also works very slowly in TESTMODE when using "empty" adviseLS functions, even if I do not use R at all?
For testing this i have used a modified function result, no R included:
Code
else {
avl = adviseLong (NEURAL,obl,INP,ipc);
avs = adviseShort(NEURAL,obs,INP,ipc);
}
in the r. file:
else if(mode == NEURAL_PREDICT && is(TRAINMODE)) ... not used here
else if(mode == NEURAL_PREDICT && is(TESTMODE)) {return(100.0);}
else if(mode == NEURAL_PREDICT && is(TRADEMODE)) ... not used here
Quote
Multiple assets....... WFA Test: 2016..2018 BAR_TIME_DBG | Bars 18155 | Bar 4000 | 38103.04 ms <- the first call takes longer because off the R init BAR_TIME_DBG | Bars 18155 | Bar 5000 | 169496.21 ms <- no R involved from here, very slow BAR_TIME_DBG | Bars 18155 | Bar 6000 | 186814.09 ms BAR_TIME_DBG | Bars 18155 | Bar 7000 | 171797.91 ms BAR_TIME_DBG | Bars 18155 | Bar 8000 | 175170.88 ms
In TESTMODE the runtime is high - but stable high - and not increasing.
Only calling the advise(L/S) functions and returning 100.0 takes so much time?
Just change #define MY_ALIST "Assets\\oanda.csv" to one that includes "AUDUSD","EURUSD" and histo from 2016 to 2018.
Only 2 assets and 2 algos are used, maybe i have done something wrong or there is a problem...
TRAINMODE 1. First hit TRAIN, you see how the time does increase and Zorro is getting slower and slower.... 2. Change TEST_NO_ADVISE to TRUE, hit TRAIN again, that's really fast!
Quote
AUDUSD AL0 | Bars 72751 | Bar 1000 | 976.77 ms AUDUSD AL0 | Bars 72751 | Bar 2000 | 1079.94 ms ... AUDUSD AL0 | Bars 72751 | Bar 7000 | 4884.04 ms AUDUSD AL0 | Bars 72751 | Bar 8000 | 5679.69 ms
TEST_NO_ADVISE TRUE AUDUSD AL0 | Bars 72751 | Bar 8000 | 8.87 ms AUDUSD AL0 | Bars 72751 | Bar 9000 | 7.34 ms ... AUDUSD AL0 | Bars 72751 | Bar 18000 | 12.68 ms AUDUSD AL0 | Bars 72751 | Bar 19000 | 9.96 ms
TESTMODE 1. Change TEST_NO_ADVISE back to FALSE 2. Hit TEST, you see how much time the simple calls need? It looks fast but wait... 3. Change TEST_NO_ADVISE to TRUE, hit TEST again, that's really fast!
Just calling the advise framework and getting simple returns does take so much time, has no one seen that before?
Last edited by laz; 08/20/1900:12.
Re: advise calls in TRAINMODE/TESTMODE slow
[Re: laz]
#477964 08/20/1908:2408/20/1908:24
The advise functions are very fast. So I would suspect that something else in your code is slow, like still calling an R function despite your changes to the neural function.
For checking what it is, simply replace NEURAL with PERCEPTRON and train again - if you then see a speed increase in the test, it's something in your R code.
Re: advise calls in TRAINMODE/TESTMODE slow
[Re: laz]
#477975 08/20/1913:0408/20/1913:04
Thanks jcl, but have you downloaded and executed my plain text (not compiled) example (advise-slow-test-0.c)?
I'm sorry but I'm really sure that it can't be in my code, because all what is done by the script is visible in the script?
If you download my posted example from above, you will see that no further R code is used there.
You should be able to reproduce it, or have you tested it with my example and observed a different behavior?
I also had DebugView running, the only R call it does - is the Rstart/Rinit at the beginning, as you can see in my example...
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Edit: I did the test with PERCEPTRON, same problem during TRAIN the runtime is increasing more and more:
Quote
advise-slow-test-0 compiling............... PERCEPTRON test 72752 Bars 2016-01-03..2018-12-31 generated AUDUSD AL0 | Bars 72751 | Bar 0 | 0.00 ms Rules: advise-slow-test-0 2016..2018 Assets Assets\oanda.csv AUDUSD AL0 | Bars 72751 | Bar 1000 | 303.89 ms AUDUSD AL0 | Bars 72751 | Bar 2000 | 1109.34 ms AUDUSD AL0 | Bars 72751 | Bar 3000 | 1861.84 ms AUDUSD AL0 | Bars 72751 | Bar 4000 | 2664.03 ms ... AUDUSD AL0 | Bars 72751 | Bar 12000 | 8534.14 ms AUDUSD AL0 | Bars 72751 | Bar 13000 | 9076.41 ms AUDUSD AL0 | Bars 72751 | Bar 14000 | 9740.15 ms AUDUSD AL0 | Bars 72751 | Bar 15000 | 10468.17 ms
But with the perceptron TESTMODE is very fast, so I stick to my assumption that something is wrong in TRAINMODE and in TESTMODE it only seems to occur when using NEURAL, as described above.
Last edited by laz; 08/20/1913:52.
Re: advise calls in TRAINMODE/TESTMODE slow
[Re: laz]
#477978 08/20/1913:5808/20/1913:58
No, sorry, I have not the time to download and test examples these days. If you can't find the reason of the slowness yourself, your final resort would be Zorrol support.
Re: advise calls in TRAINMODE/TESTMODE slow
[Re: laz]
#477979 08/20/1914:0808/20/1914:08
I can now add, that the increasing runtime problem in TRAINMODE is caused by the length of the INPUT array.
If you only use 10 or 20 inputs it is still fast enough, you will normally not recognize it, try it with 200 or 400 and you will see how slow it gets...
It would be nice, if someone could check this again, to rule out that it is my pc.
I'm still writing with the support, they don't believe it at the moment...
Just edit the Asset List and hit TRAIN...
Quote
AUDUSD AL0 | Bars 72751 | Bar 1000 | 1687.30 ms AUDUSD AL0 | Bars 72751 | Bar 2000 | 4019.43 ms AUDUSD AL0 | Bars 72751 | Bar 3000 | 7046.14 ms AUDUSD AL0 | Bars 72751 | Bar 4000 | 10052.15 ms AUDUSD AL0 | Bars 72751 | Bar 5000 | 13112.27 ms AUDUSD AL0 | Bars 72751 | Bar 7000 | 19015.53 ms AUDUSD AL0 | Bars 72751 | Bar 8000 | 22016.81 ms AUDUSD AL0 | Bars 72751 | Bar 9000 | 24695.24 ms
Last edited by laz; 08/21/1912:50.
Re: advise calls in TRAINMODE/TESTMODE slow
[Re: laz]
#477990 08/22/1911:4308/22/1911:43
wait(0) triggers the Windows message system and is of course very slow. Can take several hundred microseconds on slow systems. Don't call it on any iteration in a fast loop.
Re: advise calls in TRAINMODE/TESTMODE slow
[Re: laz]
#478439 10/22/1908:4810/22/1908:48
"The advise training speed has been improved for large training sets."
IT REALLY HAS !
advise-slow-test-0.c with 400 inputs (TRAINMODE)
Quote
AUDUSD AL0 | Bars 72751 | Bar 9000 | 400.41 ms AUDUSD AL0 | Bars 72751 | Bar 10000 | 406.71 ms AUDUSD AL0 | Bars 72751 | Bar 11000 | 356.71 ms AUDUSD AL0 | Bars 72751 | Bar 12000 | 384.86 ms AUDUSD AL0 | Bars 72751 | Bar 13000 | 404.33 ms AUDUSD AL0 | Bars 72751 | Bar 14000 | 373.60 ms AUDUSD AL0 | Bars 72751 | Bar 15000 | 412.75 ms
The delay in TESTMODE (caused by the wait()) should be fixed by the change from
Quote
if(!wait(0)) return 0;
to
Quote
if(!wait(-200)) return 0;
in the new r.h file.
Quote
EURUSD AL1 | Bars 72751 | Bar 15000 | 734.00 ms EURUSD AL1 | Bars 72751 | Bar 16000 | 569.11 ms EURUSD AL1 | Bars 72751 | Bar 17000 | 714.08 ms EURUSD AL1 | Bars 72751 | Bar 18000 | 517.06 ms
At this point I have to say a big compliment to the support! Both issues have been fixed, as you can see now - there are no delays (increasing run-times) anymore.