A class representing single training pattern and is used to train a neural network. Contains input data and expected results arrays.
Inheritance: NeuroObject
Example #1
0
			private int OutputPatternIndex(Pattern pattern)
			{
				for (int i = 0; i<pattern.OutputsCount;i++)
					if (pattern.Output[i] == 1 )
						return i;
				return -1;
			}
Example #2
0
 private static void SetPattern(Pattern aPattern, double i1, double i2, double i3, double i4, double o1,
     double o2, double o3, double o4)
 {
     aPattern.Input[0] = i1;
     aPattern.Input[1] = i2;
     aPattern.Input[2] = i3;
     aPattern.Input[3] = i4;
     aPattern.Output[0] = o1;
     aPattern.Output[1] = o2;
     aPattern.Output[2] = o3;
     aPattern.Output[3] = o4;
 }
Example #3
0
 /// <summary>
 ///     <para>
 ///         Inserts a <see cref="xpidea.neuro.net.patterns.Pattern" /> into the
 ///         <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> at the specified index.
 ///     </para>
 /// </summary>
 /// <param name="index">The zero-based index where <paramref name="value" /> should be inserted.</param>
 /// <param name=" value">The <see cref="xpidea.neuro.net.patterns.Pattern" /> to insert.</param>
 /// <seealso cref="xpidea.neuro.net.patterns.PatternsCollection.Add" />
 public void Insert(int index, Pattern value)
 {
     List.Insert(index, value);
 }
Example #4
0
 /// <summary>
 ///     <para>
 ///         Returns the index of a <see cref='xpidea.neuro.net.patterns.Pattern' /> in
 ///         the <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> .
 ///     </para>
 /// </summary>
 /// <param name='value'>The <see cref='xpidea.neuro.net.patterns.Pattern' /> to locate.</param>
 /// <returns>
 ///     <para>
 ///         The index of the <see cref='xpidea.neuro.net.patterns.Pattern' /> of <paramref name='value' /> in the
 ///         <see cref="xpidea.neuro.net.patterns.PatternsCollection" />, if found; otherwise, -1.
 ///     </para>
 /// </returns>
 /// <seealso cref='xpidea.neuro.net.patterns.PatternsCollection.Contains' />
 public int IndexOf(Pattern value)
 {
     return(List.IndexOf(value));
 }
Example #5
0
 /// <summary>
 ///     <para>
 ///         Gets a value indicating whether the
 ///         <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> contains the specified
 ///         <see cref='xpidea.neuro.net.patterns.Pattern' />.
 ///     </para>
 /// </summary>
 /// <param name='value'>The <see cref='xpidea.neuro.net.patterns.Pattern' /> to locate.</param>
 /// <returns>
 ///     <para>
 ///         <see langword='true' /> if the <see cref='xpidea.neuro.net.patterns.Pattern' /> is contained in the collection;
 ///         otherwise, <see langword='false' />.
 ///     </para>
 /// </returns>
 /// <seealso cref='xpidea.neuro.net.patterns.PatternsCollection.IndexOf' />
 public bool Contains(Pattern value)
 {
     return(List.Contains(value));
 }
Example #6
0
 /// <summary>
 ///     <para>
 ///         Adds a <see cref='xpidea.neuro.net.patterns.Pattern' /> with the specified value to the
 ///         <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> .
 ///     </para>
 /// </summary>
 /// <param name='value'>The <see cref='xpidea.neuro.net.patterns.Pattern' /> to add.</param>
 /// <returns>
 ///     <para>The index at which the new element was inserted.</para>
 /// </returns>
 /// <seealso cref="xpidea.neuro.net.patterns.PatternsCollection.AddRange" />
 public int Add(Pattern value)
 {
     return(List.Add(value));
 }
Example #7
0
 /// <summary>
 ///     <para>
 ///         Removes a specific <see cref="xpidea.neuro.net.patterns.Pattern" /> from the
 ///         <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> .
 ///     </para>
 /// </summary>
 /// <param name="value">
 ///     The <see cref="xpidea.neuro.net.patterns.Pattern" /> to remove from the
 ///     <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> .
 /// </param>
 /// <exception cref="System.ArgumentException"><paramref name="value" /> is not found in the Collection. </exception>
 public void Remove(Pattern value)
 {
     List.Remove(value);
 }
Example #8
0
 private void Create(int aInputNodesCount, int aOutputNodesCount)
 {
     inputLayerNodesCount = aInputNodesCount;
     outputLayerNodesCount = aOutputNodesCount;
     CreateNetwork();
     data = new Pattern(aInputNodesCount, aOutputNodesCount);
 }
Example #9
0
 /// <summary>
 ///     <para>
 ///         Copies the <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> values to a one-dimensional
 ///         <see cref="System.Array" /> instance at the
 ///         specified index.
 ///     </para>
 /// </summary>
 /// <param name="array">
 ///     <para>
 ///         The one-dimensional <see cref="System.Array" /> that is the destination of the values copied from
 ///         <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> .
 ///     </para>
 /// </param>
 /// <param name="index">The index in <paramref name="array" /> where copying begins.</param>
 /// <exception cref="System.ArgumentException">
 ///     <para><paramref name="array" /> is multidimensional.</para>
 ///     <para>-or-</para>
 ///     <para>
 ///         The number of elements in the <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> is greater than the
 ///         available space between <paramref name="arrayIndex" /> and the end of <paramref name="array" />.
 ///     </para>
 /// </exception>
 /// <exception cref="System.ArgumentNullException"><paramref name="array" /> is <see langword="null" />. </exception>
 /// <exception cref="System.ArgumentOutOfRangeException">
 ///     <paramref name="arrayIndex" /> is less than
 ///     <paramref name="array" />'s lowbound.
 /// </exception>
 /// <seealso cref="System.Array" />
 public void CopyTo(Pattern[] array, int index)
 {
     List.CopyTo(array, index);
 }
Example #10
0
 /// <summary>
 ///     <para>
 ///         Gets a value indicating whether the
 ///         <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> contains the specified
 ///         <see cref='xpidea.neuro.net.patterns.Pattern' />.
 ///     </para>
 /// </summary>
 /// <param name='value'>The <see cref='xpidea.neuro.net.patterns.Pattern' /> to locate.</param>
 /// <returns>
 ///     <para>
 ///         <see langword='true' /> if the <see cref='xpidea.neuro.net.patterns.Pattern' /> is contained in the collection;
 ///         otherwise, <see langword='false' />.
 ///     </para>
 /// </returns>
 /// <seealso cref='xpidea.neuro.net.patterns.PatternsCollection.IndexOf' />
 public bool Contains(Pattern value)
 {
     return List.Contains(value);
 }
Example #11
0
 /// <summary>
 ///     <para>
 ///         Copies the elements of an array to the end of the <see cref="xpidea.neuro.net.patterns.PatternsCollection" />
 ///         .
 ///     </para>
 /// </summary>
 /// <param name="value">
 ///     An array of type <see cref="xpidea.neuro.net.patterns.Pattern" /> containing the objects to add to the collection.
 /// </param>
 /// <seealso cref="xpidea.neuro.net.patterns.PatternsCollection.Add" />
 public void AddRange(Pattern[] value)
 {
     for (var i = 0; (i < value.Length); i = (i + 1))
     {
         Add(value[i]);
     }
 }
Example #12
0
 /// <summary>
 ///     <para>
 ///         Adds a <see cref='xpidea.neuro.net.patterns.Pattern' /> with the specified value to the
 ///         <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> .
 ///     </para>
 /// </summary>
 /// <param name='value'>The <see cref='xpidea.neuro.net.patterns.Pattern' /> to add.</param>
 /// <returns>
 ///     <para>The index at which the new element was inserted.</para>
 /// </returns>
 /// <seealso cref="xpidea.neuro.net.patterns.PatternsCollection.AddRange" />
 public int Add(Pattern value)
 {
     return List.Add(value);
 }
Example #13
0
 /// <summary>
 ///     <para>
 ///         Initializes a new instance of <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> containing any array
 ///         of <see cref='xpidea.neuro.net.patterns.Pattern' /> objects.
 ///     </para>
 /// </summary>
 /// <param name='value'>
 ///     A array of <see cref='xpidea.neuro.net.patterns.Pattern' /> objects with which to intialize the collection
 /// </param>
 public PatternsCollection(Pattern[] value)
 {
     AddRange(value);
 }
Example #14
0
 /// <summary>
 ///     Overridden.Sets input and output values from the pattern.
 /// </summary>
 /// <param name="pattern"></param>
 public override void SetValuesFromPattern(Pattern pattern)
 {
     for (var i = 0; i < pattern.InputsCount; i++)
         data.Input[i] = pattern.Input[i];
     for (var i = 0; i < pattern.OutputsCount; i++)
         data.Output[i] = pattern.Output[i];
 }
Example #15
0
 /// <summary>
 ///     <para>
 ///         Removes a specific <see cref="xpidea.neuro.net.patterns.Pattern" /> from the
 ///         <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> .
 ///     </para>
 /// </summary>
 /// <param name="value">
 ///     The <see cref="xpidea.neuro.net.patterns.Pattern" /> to remove from the
 ///     <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> .
 /// </param>
 /// <exception cref="System.ArgumentException"><paramref name="value" /> is not found in the Collection. </exception>
 public void Remove(Pattern value)
 {
     List.Remove(value);
 }
Example #16
0
 /// <summary>
 ///     <para>
 ///         Returns the index of a <see cref='xpidea.neuro.net.patterns.Pattern' /> in
 ///         the <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> .
 ///     </para>
 /// </summary>
 /// <param name='value'>The <see cref='xpidea.neuro.net.patterns.Pattern' /> to locate.</param>
 /// <returns>
 ///     <para>
 ///         The index of the <see cref='xpidea.neuro.net.patterns.Pattern' /> of <paramref name='value' /> in the
 ///         <see cref="xpidea.neuro.net.patterns.PatternsCollection" />, if found; otherwise, -1.
 ///     </para>
 /// </returns>
 /// <seealso cref='xpidea.neuro.net.patterns.PatternsCollection.Contains' />
 public int IndexOf(Pattern value)
 {
     return List.IndexOf(value);
 }
Example #17
0
 private static void SetPattern(Pattern aPattern, double x, double y, double z)
 {
     aPattern.Input[0] = x;
     aPattern.Input[1] = y;
     aPattern.Output[0] = z;
 }
Example #18
0
 /// <summary>
 ///     <para>
 ///         Inserts a <see cref="xpidea.neuro.net.patterns.Pattern" /> into the
 ///         <see cref="xpidea.neuro.net.patterns.PatternsCollection" /> at the specified index.
 ///     </para>
 /// </summary>
 /// <param name="index">The zero-based index where <paramref name="value" /> should be inserted.</param>
 /// <param name=" value">The <see cref="xpidea.neuro.net.patterns.Pattern" /> to insert.</param>
 /// <seealso cref="xpidea.neuro.net.patterns.PatternsCollection.Add" />
 public void Insert(int index, Pattern value)
 {
     List.Insert(index, value);
 }
Example #19
0
 /// <summary>
 ///     Sets input values of the network from the pattern.
 /// </summary>
 /// <param name="pattern">Training pattern.</param>
 public virtual void SetValuesFromPattern(Pattern pattern)
 {
     for (var i = 0; i < pattern.InputsCount; i++)
         nodes[i].Value = pattern.Input[i];
 }
Example #20
0
 /// <summary>
 ///     Overridden.Loads the values into the input layer from the pattern.
 /// </summary>
 /// <param name="pattern">Pattern.</param>
 public override void SetValuesFromPattern(Pattern pattern)
 {
     for (var i = 0; i < pattern.InputsCount; i++)
         nodes[i].Value = pattern.Input[i];
     for (var i = 0; i < pattern.OutputsCount; i++)
         nodes[i + InputNodesCount].Value = pattern.Output[i];
 }