//
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        internal virtual IBackPropagation CreateIBackPropagation()
        {
            // TODO: Instantiate an appropriate concrete class.
            IBackPropagation target = null;

            return(target);
        }
        public void BackPropagateTest()
        {
            IBackPropagation target = CreateIBackPropagation(); // TODO: Initialize to an appropriate value

            target.BackPropagate();
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Esempio n. 3
0
        public void LoadNetwork(string path)
        {
            FileStream      FS = new FileStream(path, FileMode.Open);
            BinaryFormatter BF = new BinaryFormatter();

            NeuralNet = (IBackPropagation <T>)BF.Deserialize(FS);
            FS.Close();
        }
        public void InitializeNetworkTest()
        {
            IBackPropagation target      = CreateIBackPropagation(); // TODO: Initialize to an appropriate value
            List <FaceImage> trainingSet = null;                     // TODO: Initialize to an appropriate value

            target.InitializeNetwork(trainingSet);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
 public NeuralNetwork(IBackPropagation IBackPro, GlobalSettingsModel settingsModel)
 {
     _neuralNet              = IBackPro;
     _trainingSet            = settingsModel.TrainingSet;
     _distractionTrainingSet = settingsModel.DistractionTrainingSet;
     _neuralNet.InitializeNetwork(_trainingSet);
     _settingsModel = settingsModel;
 }
        public void LoadNetwork(string path)
        {
            FileStream      fileStream      = new FileStream(path, FileMode.Open);
            BinaryFormatter binaryFormatter = new BinaryFormatter();

            _neuralNet = (IBackPropagation)binaryFormatter.Deserialize(fileStream);
            fileStream.Close();
        }
Esempio n. 7
0
        /// <summary>
        ///A test for NeuralNetwork`1 Constructor
        ///</summary>
        public void NeuralNetworkConstructorTest1Helper <T>()
            where T : IComparable <T>
        {
            IBackPropagation  IBackPro    = null; // TODO: Initialize to an appropriate value
            List <FaceImage>  trainingSet = null; // TODO: Initialize to an appropriate value
            NeuralNetwork <T> target      = new NeuralNetwork <T>(IBackPro, trainingSet);

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
        public void GetErrorTest()
        {
            IBackPropagation target   = CreateIBackPropagation(); // TODO: Initialize to an appropriate value
            double           expected = 0F;                       // TODO: Initialize to an appropriate value
            double           actual;

            actual = target.GetError();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void ForwardPropagateTest()
        {
            IBackPropagation target = CreateIBackPropagation(); // TODO: Initialize to an appropriate value

            double[] pattern = null;                            // TODO: Initialize to an appropriate value
            string   output  = string.Empty;                    // TODO: Initialize to an appropriate value

            target.ForwardPropagate(pattern, output);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        public NeuralNetwork(IBackPropagation IBackPro, List <FaceImage> trainingSet)
        {
            if (trainingSet == null)
            {
                throw new ArgumentNullException("trainingSet");
            }

            _maxError = Constants.MAX_ERROR;
            _maxIter  = Constants.MAX_ITERATION;

            _neuralNet   = IBackPro;
            _trainingSet = trainingSet;
            _neuralNet.InitializeNetwork(_trainingSet);
        }
Esempio n. 11
0
 /* constructors. */
 public RandomSimulation(IMCTSPlayer thisPlayer, IMCTSPlayer opponent, Board b, string expansion, string backPropagation)
 {
     board           = new Board(b);
     this.thisPlayer = thisPlayer;
     this.opponent   = opponent;
     wins            = visits = 0;
     exp             = ExpansionFactory.Create(expansion);
     bp           = BackPropagationFactory.Create(backPropagation);
     rand         = new Random();
     workers      = new List <Thread>(threadNo);
     mutex        = new Mutex();
     isSimulating = false;
     root         = null;
     treeRoot     = null;
 }
Esempio n. 12
0
        void InitializeBackPropagation()
        {
            switch (CostFunction)
            {
            case CostFuntionKind.Quadratic:
                backPropagation = new BackPropagationQuadratic(neuralNetAccessor);
                break;

            case CostFuntionKind.CrossEntropy:
                backPropagation = new BackPropagationCrossEntropy(neuralNetAccessor);
                break;

            default:
                throw new System.NotImplementedException();
            }
        }
        public void RecognizeTest()
        {
            IBackPropagation target = CreateIBackPropagation(); // TODO: Initialize to an appropriate value

            double[] Input                    = null;           // TODO: Initialize to an appropriate value
            string   MatchedHigh              = string.Empty;   // TODO: Initialize to an appropriate value
            string   MatchedHighExpected      = string.Empty;   // TODO: Initialize to an appropriate value
            double   OutputValueHight         = 0F;             // TODO: Initialize to an appropriate value
            double   OutputValueHightExpected = 0F;             // TODO: Initialize to an appropriate value
            string   MatchedLow               = string.Empty;   // TODO: Initialize to an appropriate value
            string   MatchedLowExpected       = string.Empty;   // TODO: Initialize to an appropriate value
            double   OutputValueLow           = 0F;             // TODO: Initialize to an appropriate value
            double   OutputValueLowExpected   = 0F;             // TODO: Initialize to an appropriate value

            target.Recognize(Input, ref MatchedHigh, ref OutputValueHight, ref MatchedLow, ref OutputValueLow);
            Assert.AreEqual(MatchedHighExpected, MatchedHigh);
            Assert.AreEqual(OutputValueHightExpected, OutputValueHight);
            Assert.AreEqual(MatchedLowExpected, MatchedLow);
            Assert.AreEqual(OutputValueLowExpected, OutputValueLow);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        public void LoadNetwork(string path)
        {
            try
            {
                using (var fs = new FileStream(path, FileMode.Open))
                {
                    var bf = new BinaryFormatter();
                    _neuralNet = (IBackPropagation)bf.Deserialize(fs);
                    fs.Close();
                }
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, "IO Pocily");
                if (rethrow)
                {
                    throw;
                }

                MessageBox.Show("Failed load network");
            }
        }
Esempio n. 15
0
 public NeuralNetwork(IBackPropagation <T> IBackPro, Dictionary <T, double[]> trainingSet)
 {
     NeuralNet   = IBackPro;
     TrainingSet = trainingSet;
     NeuralNet.InitializeNetwork(TrainingSet);
 }