Beispiel #1
0
        public ActionResult TrainMany(InputOutputViewModel vm)
        {
            vm.HopfieldOutput = new MatrixViewModel(64);
            vm.ARTOutput      = new MatrixViewModel(64);
            vm.patterns       = patterns;


            // trenowanie Hopfielda
            hp = new Hopfield();

            hp.TrainByPseudoInverse(patterns);

            //trenowanie ART
            art = new ART1();
            art.Train(teachingSet);
            //art.Train(patterns);

            art2 = new ART();
            art2.Train(teachingSet);

            int[,] randomPatterns = new int[10, 64];
            int[] numbers = new int[9];
            foreach (int i in numbers)
            {
                var rnd = new Random();
                numbers[i] = rnd.Next(0, 9);
            }



            ViewBag.Message = "Neural networks were trained by patterns.";

            return(View("Index", vm));
        }
        private ART1 Create()
        {
            var network = new ART1(6, 3);

            network.WeightsF1ToF2[1, 1] = 2.0;
            network.WeightsF2ToF1[2, 2] = 3.0;
            return(network);
        }
        public void TestPersistSerial()
        {
            ART1 network = Create();

            SerializeObject.Save(SERIAL_FILENAME.ToString(), network);
            var network2 = (ART1)SerializeObject.Load(SERIAL_FILENAME.ToString());

            Validate(network2);
        }
        public void TestPersistEG()
        {
            ART1 network = Create();

            EncogDirectoryPersistence.SaveObject(EG_FILENAME, network);
            var network2 = (ART1)EncogDirectoryPersistence.LoadObject(EG_FILENAME);

            Validate(network2);
        }
Beispiel #5
0
        /// <summary>
        /// Generate the neural network.
        /// </summary>
        ///
        /// <returns>The generated neural network.</returns>
        public IMLMethod Generate()
        {
            var art = new ART1(_inputNeurons, _outputNeurons)
            {
                A1        = _a1,
                B1        = _b1,
                C1        = _c1,
                D1        = _d1,
                L         = _l,
                Vigilance = _vigilance
            };

            return(art);
        }
 private void Validate(ART1 network)
 {
     Assert.AreEqual(6, network.F1Count);
     Assert.AreEqual(3, network.F2Count);
     Assert.AreEqual(18, network.WeightsF1ToF2.Size);
     Assert.AreEqual(18, network.WeightsF2ToF1.Size);
     Assert.AreEqual(2.0, network.WeightsF1ToF2[1, 1]);
     Assert.AreEqual(3.0, network.WeightsF2ToF1[2, 2]);
     Assert.AreEqual(1.0, network.A1);
     Assert.AreEqual(1.5, network.B1);
     Assert.AreEqual(5.0, network.C1);
     Assert.AreEqual(0.9, network.D1);
     Assert.AreEqual(0.9, network.Vigilance);
 }