osama-raddad/encog-java

Little optimization in SmartLearningRate

Closed this issue · 2 comments

In SmartLearningRate in the method determineTrainingSize(), you scan all row 
and increment a counter to know the number of row.

I think if the dataset is Indexable you should be able to ask the number of row 
directly.

private long determineTrainingSize() {
    if (this.train.getTraining() instanceof Indexable) {
       return ((Indexable) this.train.getTraining()).getRecordCount();
    }
    //... same code as previously....
}

I know it's a very little optimisation and only for baskprop but that's my 2 
cents.

Regards 

Julien Blaize

Original issue reported on code.google.com by julien.b...@gmail.com on 13 Oct 2010 at 7:37

Implemented performance improvement.

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

  • Changed state: Verified
But not correct! You check if this.train is a instance of Indexable but then 
cast this to Indexable... There is something wrong!

Original comment by TowelieDasTuch@gmail.com on 15 Oct 2010 at 8:25