osama-raddad/encog-java

TrainFlatNetworkSCG doesn't respect getNumberOfThread in the init (version 2.5)

Closed this issue · 4 comments

Hi,

i am testing the 2.5 version right now. In my environnement i don't want to use 
CPL or multiThreading for encog because i already have a big threading 
structure for all type of datamining algorithm on top of it.

When i run a ScaledConjugateGradient i always have a Thread pool created by 
encog in version 2.5.(and i don't want to)

from TrainFlatNetworkSCG constructor there is a call to calculateGradients(). 
In this call there is a call to super.calculateGradients().(we are now in 
TrainFlatNetworkProp) And there the workers array is initialized by a call to 
init(). 

But when we are here we don't have the ability to set the number of thread 
(because we are still in the constructor) and the default 0 is used.

So to workaround i had to create 2 classes one that extends 
ScaledConjugateGradient and that use a second class that extends 
TrainFlatNetworkSCG and override the number of thread to put 1 instead of 0.(in 
the protected field because you don't call the method but use the field and 
that's not nice for people who extends your classes).

I hope i was clear enought. 

Thanks a lot for your great work on this library. 
If i find new bug do you prefer if i report here or in encog Java forum ?

Regards

Julien Blaize

Original issue reported on code.google.com by julien.b...@gmail.com on 11 Oct 2010 at 11:48

Reporting here works just fine.  Less changes of me losing track of it.  Thanks 
for the very clear report, I will take a look.

Original comment by heatonre...@gmail.com on 13 Oct 2010 at 2:24

Original comment by heatonre...@gmail.com on 13 Oct 2010 at 2:25

Fixed SCG so the call to calc gradients is outside the constructor

Original comment by heatonre...@gmail.com on 15 Oct 2010 at 1:50

Original comment by heatonre...@gmail.com on 15 Oct 2010 at 1:50

  • Changed state: Verified