encog-dotnet-core icon indicating copy to clipboard operation
encog-dotnet-core copied to clipboard

Missing base call in ResilientPropagation.PostIteration

Open Nathaire opened this issue 10 years ago • 2 comments

Hi,

I'm new to Encog and try to play a little with it. I've tried some Training configuration and get stuck while trying to use a ResilientPropagation with an IEndTrainingStrategy. The method void PostIteration() of the strategy was never called.

I don't know if it's a real issue (maybe using an IEndTrainingStrategy with a ResilientPropagation is not a wanted usecase), but maybe you should consider calling the base method while overriding virtual ones.

In ResilientPropagation.cs:

public override void PostIteration()
{
    _lastError = Error;
}

should be replace with

public override void PostIteration()
{
    base.PostIteration();
    _lastError = Error;
}

Nathaire avatar Jul 28 '14 14:07 Nathaire

@Nathaire have you validated the end strategy as working as desired after training with this change? This is interesting to me, as well.

jeroldhaas avatar Jul 29 '14 18:07 jeroldhaas

@jeroldhaas yes, it works as desired. I've quickly take a look at Encog Java sources and the call to super is made there:

public void postIteration() {
    super.postIteration();
    this.lastError = getError();
}

Nathaire avatar Jul 31 '14 04:07 Nathaire