Click here to Skip to main content
15,886,199 members
Articles / Programming Languages / C#

Neural Dot Net Pt 3 The Adaline Network

Rate me:
Please Sign up or sign in to vote.
3.71/5 (16 votes)
23 Oct 200316 min read 73.2K   379   41  
A neural network library in C#.
using System;
using SharpUtils;
using System.Collections;
using System.Xml;
using System.Text;

namespace Neural_Net_Library
{
	/// <summary>
	/// Summary description for SelfOrganizingNetworkWord.
	/// </summary>
	public class SelfOrganizingNetworkWordNode : SelfOrganizingNetworkNode
	{
		private DebugLevel debugLevel;
		private Logger log;


		/// <summary>
		/// most basic constructor
		/// </summary>
		public SelfOrganizingNetworkWordNode( Logger log ) : base( log )
		{
			debugLevel = new DebugLevel( DebugLevel.currentLevel );
			this.log = log;
		}

		public SelfOrganizingNetworkWordNode( Logger log, int nNodeValueSize, int nNodeErrorSize ) : base( log, nNodeValueSize, nNodeErrorSize )
		{
			debugLevel = new DebugLevel( DebugLevel.currentLevel );
			this.log = log;
		}


		public SelfOrganizingNetworkWordNode( Logger log, double dLearningRate ) : base( log, dLearningRate )
		{
			debugLevel = new DebugLevel( DebugLevel.currentLevel );
			this.log = log;
		}


		public override void Save(XmlWriter xmlWriter)
		{
			xmlWriter.WriteStartElement( "SelfOrganizingNetworkWordNode" );
			base.Save (xmlWriter);
			xmlWriter.WriteEndElement();
		}

		public override void Load(XmlReader xmlReader)
		{
			base.Load (xmlReader);
		}

		public new string ClassName
		{
			get
			{
				return this.ToString();
			}
		}
	}


	public class SelfOrganizingNetworkWordLink : SelfOrganizingNetworkLink
	{
		private DebugLevel debugLevel;
		private Logger log;

		public SelfOrganizingNetworkWordLink( Logger log ) : base( log )
		{
			debugLevel = new DebugLevel( DebugLevel.currentLevel );
			this.log = log;
		}


		public override void Save(XmlWriter xmlWriter)
		{
			xmlWriter.WriteStartElement( "SelfOrganizingNetworkWordLink" );
			base.Save (xmlWriter);
			xmlWriter.WriteEndElement();
		}


		public override void Load(XmlReader xmlReader)
		{
			base.Load (xmlReader);
		}


		public new string ClassName
		{
			get
			{
				return this.ToString();
			}
		}
	}


	public class SelfOrganizingNetworkWordNetwork : SelfOrganizingNetwork
	{
		private DebugLevel debugLevel;
		private Logger log;

		public SelfOrganizingNetworkWordNetwork( Logger log ) : base( log )
		{
			debugLevel = new DebugLevel( DebugLevel.currentLevel );
			this.log = log;
		}

		public SelfOrganizingNetworkWordNetwork( Logger log, int nNumberOfInputs, int nHorizontalSize, int nVerticalSize, double dInitialLearningRate, double dFinalLearningRate, int nInitialNeighborSize, int nFinalNeighborhoodSize, int nNeighborDecrement, int nIterations ) : base( log, nNumberOfInputs, nHorizontalSize, nVerticalSize, dInitialLearningRate, dFinalLearningRate, nInitialNeighborSize, nFinalNeighborhoodSize, nNeighborDecrement, nIterations )
		{
			debugLevel = new DebugLevel( DebugLevel.currentLevel );
			this.log = log;
		}

		public override void Save(XmlWriter xmlWriter)
		{
			xmlWriter.WriteStartElement( "SelfOrganizingNetworkWordNetwork" );
			base.Save (xmlWriter);
			xmlWriter.WriteEndElement();
		}

		public override void Load(XmlReader xmlReader)
		{
			base.Load (xmlReader);
		}


		public new string ClassName
		{
			get
			{
				return this.ToString();
			}
		}
	}

	public class SelfOrganizingNetworkWordPattern : AdalineWordPattern
	{
		private DebugLevel debugLevel;
		private Logger log;

		public SelfOrganizingNetworkWordPattern( Logger log ) : base( log )
		{
			debugLevel = new DebugLevel( DebugLevel.currentLevel );
			this.log = log;
		}

		public SelfOrganizingNetworkWordPattern( Logger log, string strOne, string strTwo ) : base( log )
		{
			debugLevel = new DebugLevel( DebugLevel.currentLevel );
			this.log = log;
			
			this.InSet.Add( strOne );
			this.InSet.Add( strTwo );
		}

		public new string Data()
		{
			StringBuilder strString = new StringBuilder();
			strString.Append( "Pattern ID = " + this.PatternID.ToString() );
			for( int n=0; n<this.InputSize(); n++ )
				strString.Append(  this.InSet[ n ].ToString() + " " );

			return strString.ToString();
		}
		
		public new string ClassName
		{
			get
			{
				return this.ToString();
			}
		}

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions