C# MLP Backprop Code
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication1 //////////////////////////////////////////////////////////////////////////// //MLP neural network in C# //Original source code by Dr Phil Brierley //www.philbrierley.com //Translated to C++ - dspink Sep 2005 //Translated to C# by Dr Eddie O'Brien - March 2006 //For the C# GUI, just needs a button (name = Go) and // a textBox (name = cout) - set MulitLine property to True // and set Scroll property to Vertical. //This code may be freely used and modified at will //C# compiled using free Microsoft Visual C# 2005 Express (.NET Framework 2.0) //////////////////////////////////////////////////////////////////////////// { public partial class Form1 : Form { public Form1() { InitializeComponent(); } //// Data dependent settings //// const int numInputs = 3; const int numPatterns = 4; //// User defineable settings //// const int numHidden = 4; const int numEpochs = 500; const double LR_IH = 0.7; const double LR_HO = 0.07; private void Go_Click(object sender, EventArgs e) { // initiate the weights initWeights(); // load in the data initData(); // train the network for(int j = 0; j <= numEpochs; j++) { for(int i = 0; i