public virtual void Learn(CY_NN_Dataset set, int trainingEpochs) { isStopping = false; Initialize(); for (int currentIteration = 0; currentIteration < trainingEpochs; currentIteration++) { int[] randomOrder = GetRandomOrder(set.trainingSamples.Count); OnBeginEpoch(currentIteration, set); if (jitterEpoch > 0 && currentIteration % jitterEpoch == 0) { for (int i = 0; i < connectors.Count; i++) { connectors[i].noise(jitterNoiseLimit); } } for (int index = 0; index < set.trainingSamples.Count; index++) { CY_NN_Dataset_Entry e = set[randomOrder[index]]; OnBeginSample(currentIteration, e); LearnSample(set[randomOrder[index]], currentIteration, trainingEpochs); OnEndSample(currentIteration, e); if (isStopping) { isStopping = false; return; } } OnEndEpoch(currentIteration, set); if (isStopping) { isStopping = false; return; } } }
protected virtual void OnEndEpoch(int currentIteration, CY_NN_Dataset set) { if (EndEpochEvent != null) { EndEpochEvent(this, new CY_Dataset_Epoch_Args(currentIteration, set)); } }
protected override void OnEndEpoch(int i, CY_NN_Dataset set) { mse /= set.trainingSamples.Count; base.OnEndEpoch(i, set); }
protected override void OnBeginEpoch(int i, CY_NN_Dataset set) { mse = 0d; base.OnBeginEpoch(i, set); }
public CY_Dataset_Epoch_Args(int trainingIteration, CY_NN_Dataset set) { this.set = set; this.i = trainingIteration; }