public ConstructiveTrainer(double learnRate = 0.05, double minError = 0.01, double momentum = 0.01, int maxEpochs = 100, int show = 10, int maxHiddenLayers = 2, IPerformanceFunction pFunc = null, TrainingModes tMode = TrainingModes.OffLine) : base(learnRate, minError, momentum, maxEpochs, show, pFunc, tMode) { this.maxHiddenLayers = maxHiddenLayers; subTrainer = new PerceptronTrainer(learnRate, minError, momentum, maxEpochs, show, pFunc, tMode); }
public Trainer(double learnRate = 0.05, double minError = 0.01, double momentum = 0.01, int maxEpochs = 100, int show = 10, IPerformanceFunction pFunc = null, TrainingModes tMode = TrainingModes.OffLine) { this.learnRate = learnRate; this.minError = minError; this.momentum = momentum; this.maxEpochs = maxEpochs; this.show = show; this.tMode = tMode; if (pFunc != null) { this.pFunc = pFunc; } }
private Tuple <Type, object> EvaluateCreateTrainer(ParseTreeNode node) { var trainerClassName = node.ChildNodes[0]; var trainerParams = EvaluateKeyValuePair(node.ChildNodes[1]); double learnRate = 0.05; double minError = 0.01; int maxEpochs = 100; int maxHiddenLayers = 2; int show = 10; IPerformanceFunction pFunc = null; TrainingModes tMode = TrainingModes.OnLine; if (trainerParams.ContainsKey("learnRate")) { learnRate = double.Parse(trainerParams["learnRate"]); } if (trainerParams.ContainsKey("minError")) { minError = double.Parse(trainerParams["minError"]); } if (trainerParams.ContainsKey("maxEpochs")) { maxEpochs = int.Parse(trainerParams["maxEpochs"]); } if (trainerParams.ContainsKey("maxHiddenLayers")) { maxHiddenLayers = int.Parse(trainerParams["maxHiddenLayers"]); } if (trainerParams.ContainsKey("show")) { show = int.Parse(trainerParams["show"]); } if (trainerParams.ContainsKey("performanceFunction")) { pFunc = (IPerformanceFunction)(typeof(PerformanceFunctions) .GetField(trainerParams["performanceFunction"]) .GetValue(null)); } if (trainerParams.ContainsKey("mode")) { tMode = (TrainingModes)Enum.Parse(typeof(TrainingModes), trainerParams["mode"]); } Trainer trainer = null; switch (trainerClassName.Token.Text) { case "BackPropagationTrainer": trainer = new BackPropagationTrainer(learnRate, minError, 0.01, maxEpochs, show, pFunc, tMode); break; case "PerceptronTrainer": trainer = new PerceptronTrainer(learnRate, minError, 0.01, maxEpochs, show, pFunc, tMode); break; case "ConstructiveTrainer": trainer = new ConstructiveTrainer(learnRate, minError, 0.01, maxEpochs, show, maxHiddenLayers, pFunc, tMode); break; default: throw new Exception("Trainer of kind " + trainerClassName.Token.Text + " does not exist."); } return(new Tuple <Type, object>(typeof(Trainer), trainer)); }
public PerceptronTrainer(double learnRate = 0.05, double minError = 0.01, double momentum = 0.01, int maxEpochs = 100, int show = 10, IPerformanceFunction pFunc = null, TrainingModes tMode = TrainingModes.OffLine) : base(learnRate, minError, momentum, maxEpochs, show, pFunc, tMode) { }