void ShowBtnClick(object sender, EventArgs e) { object selectedItem = patternsComboBox.SelectedItem; if (selectedItem != null && selectedItem.ToString().Trim().Length != 0) { string patternName = selectedItem.ToString(); NetworkTeachingPair dictPair = PatternDictionary.GetInstance().GetTeachingPairForPattern(patternName); patternInput.LoadPattern(dictPair.Input); } }
public void Teach(NetworkTeachingPair pair, double ratio) { if (NeuronInputDimension != pair.Input.Length) { throw new ArgumentException(string.Format(MISALIGNED_TEACHING_PAIR_MSG, NeuronInputDimension, pair.Input.Length)); } IList <TeachingPair> teachingPairs = pair.DecomposeToTeachingPairs(); for (int i = 0; i < neurons.Count; i++) { neurons[i].Teach(teachingPairs[i], ratio); } }
void CorrectBtnClick(object sender, EventArgs e) { object selectedItem = patternsComboBox.SelectedItem; if (selectedItem != null && selectedItem.ToString().Trim().Length != 0) { string patternName = selectedItem.ToString(); NetworkTeachingPair dictPair = PatternDictionary.GetInstance().GetTeachingPairForPattern(patternName); double[] currentPattern = patternInput.GetNetworkInput(); oneLayerNetwork.Teach(new NetworkTeachingPair(currentPattern, dictPair.Output), Commons.TEACHING_RATIO); MessageBox.Show("Taught successfully.", "Correction Completed"); } }
/// <summary> /// Back-propagation teaching method /// </summary> public void Teach(NetworkTeachingPair pair, double speedRatio, double ratio) { double[] actualSignal = FireSignal(pair.Input); double[] expectedSignal = pair.Output; int len = expectedSignal.Length; double[] errors = new double[len]; for (int i = 0; i < len; i++) { double oi = actualSignal[i], ti = expectedSignal[i]; errors[i] = -oi * (1 - oi) * (ti - oi); } for (int i = Size - 2; i >= 0; i--) { //double[] signal = FireSignal( } }