Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 744 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Keras predict_proba() call time #480084
05/19/20 17:49
05/19/20 17:49
Joined: Mar 2020
Posts: 41
J
jbhunter Offline OP
Newbie
jbhunter  Offline OP
Newbie
J

Joined: Mar 2020
Posts: 41

I have been playing around with the deep learning demo script, DeepLearn.c. I started with deepnet and then moved to keras. First tried CPU then GPU training, now back to CPU. However consistently the predict_proba() function in keras is very slow. Training is quick and testing takes forever. I timed the predict_proba calls in R with tictoc. I am getting 30-33ms per prediction. A couple per bar and the test time is very long. Does this seem appropriate and/or normal? If not, any ideas on what might be going on? The ml files are small 10-20 kb.

By the way I have tried directly in the R console and get the same result. The R bridge does not seem to be causing any issues.

Re: Keras predict_proba() call time [Re: jbhunter] #480087
05/19/20 19:32
05/19/20 19:32
Joined: May 2020
Posts: 27
Germany
M
Morris Offline
Newbie
Morris  Offline
Newbie
M

Joined: May 2020
Posts: 27
Germany
You may want to try predict_on_batch() instead of predict_proba(). I am using Keras with Tensorflow on Python, not R, but had the same issue with prediction time, and predict_on_batch() turned out to be more than an order of magnitude faster, in my setup.

Re: Keras predict_proba() call time [Re: jbhunter] #480090
05/19/20 21:08
05/19/20 21:08
Joined: Mar 2020
Posts: 41
J
jbhunter Offline OP
Newbie
jbhunter  Offline OP
Newbie
J

Joined: Mar 2020
Posts: 41
Did you see the improvement even when using just one value? I will give it a try either way, thanks for the tip!

Re: Keras predict_proba() call time [Re: jbhunter] #480095
05/20/20 08:20
05/20/20 08:20
Joined: May 2020
Posts: 27
Germany
M
Morris Offline
Newbie
Morris  Offline
Newbie
M

Joined: May 2020
Posts: 27
Germany
Yes, significant speedup both with one value (vector) as well as with matrices...

Re: Keras predict_proba() call time [Re: jbhunter] #480100
05/20/20 11:18
05/20/20 11:18
Joined: Mar 2020
Posts: 41
J
jbhunter Offline OP
Newbie
jbhunter  Offline OP
Newbie
J

Joined: Mar 2020
Posts: 41
I did see some improvement on this with a single data point. It went from about 30-33ms down to 19ms with just one row of data. It is a bit odd, every 14th call or so is the 30ms.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1