/// <summary> /// For development purposes only, later Console App should be removed /// </summary> /// <param name="args"></param> static void Main(string[] args) { Console.WriteLine("Welcome to Our Neural Network project"); int[,] test = new int[, ] { { 1, 1, 1, 1 }, { -1, -1, -1, -1 }, { 1, -1, 1, -1 } }; AssociativeMemory mem = new AssociativeMemory(test); Console.WriteLine("Hopfield Matrix:"); Console.WriteLine(mem.T); var res = mem.Test(new List <int>() { 1, 1, 1, 1 }); Console.WriteLine("Result after test:"); for (int i = 0; i < res.Result.Count; i++) { Console.Write(res.Result[i] + " "); } Console.WriteLine(); }
public void Write(AssociativeMemory mem) { if (mem != null) { _builder.Append(mem.T); } _builder.Append("\n"); }
public void AssociateWithVectorResultingInTwoVectorsLoop() { AssociativeMemory mem = new AssociativeMemory(input, 10); TestResult result = mem.Test(vect2); Assert.AreEqual(result.Result.SequenceEqual(vect2), true); Assert.AreEqual(result.IsConvergent, false); Assert.AreEqual(result.IsTwoVectorsLoop, true); Assert.AreEqual(result.SecondVector.SequenceEqual(vect3), true); Assert.AreEqual(result.NumberOfIterations, 2); }
public void AssociateWithExistingVector() { AssociativeMemory mem = new AssociativeMemory(input, 10); TestResult result = mem.Test(vect); Assert.AreEqual(result.Result.SequenceEqual(vect), true); Assert.AreEqual(result.IsConvergent, true); Assert.AreEqual(result.IsTwoVectorsLoop, false); Assert.AreEqual(result.SecondVector.SequenceEqual(new List <int>()), true); Assert.AreEqual(result.NumberOfIterations, 1); }
private void OnCreateMemoryClick(object obj) { try { _associativeMemory = new AssociativeMemory(_input.Values, _input.NumberOfVectors, _input.VectorSize); } catch (Exception ex) { MessageBox.Show("Error creating associative memory" + ex.Message); } finally { if (_associativeMemory != null) { _writer.Write("Associative memory created"); _writer.Write("Hopfield Matrix"); _writer.Write(_associativeMemory); _writer.Write("Now you can input a test vector of length " + _input.VectorSize); TestVectorText = string.Empty; IsEnabledTestVectorTextBox = true; ConsoleText = _writer.Text; } } }