コード例 #1
0
        public Form1()
        {
            InitializeComponent();

            _param = new nnParameters
            {
                LearningRate = 0.9,
                Layers       = new List <int>()
                {
                    3, 3, 3
                },
                InitValues = new List <double>()
                {
                    0.9, 0.1, 0.8
                },

                TrainCycles = 100000,
                TrainInput  = new[] { 0.9, 0.1, 0.8 },
                TrainOutput = new[] { 0.726, 0.708, 0.778 }
            };

            propertyGridTrain.SelectedObject = _param;
            _neuralNetwork = new NeuralNet.NeuralNetwork(_param.LearningRate, _param.Layers);
            propertyGridNN.SelectedObject = _neuralNetwork;

            _trainWorker                     = new BackgroundWorker();
            _trainWorker.DoWork             += TrainWorkerOnDoWork;
            _trainWorker.ProgressChanged    += TrainWorkerOnProgressChanged;
            _trainWorker.RunWorkerCompleted += TrainWorkerOnRunWorkerCompleted;
        }
コード例 #2
0
 private void loadNNToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         _neuralNetwork = SerializeHelper.DeserializeFromFile <NeuralNet.NeuralNetwork>(openFileDialog.FileName);
         propertyGridTrain.SelectedObject = _param;
     }
 }
コード例 #3
0
 private void TrainWorkerOnDoWork(object sender, DoWorkEventArgs doWorkEventArgs)
 {
     _neuralNetwork = new NeuralNet.NeuralNetwork(_param.LearningRate, _param.Layers);
     for (int i = 0; i < _param.TrainCycles; i++)
     {
         NeuralNet.NeuralNetwork.Train(_neuralNetwork, _param.TrainInput, _param.TrainOutput);
         _trainWorker.ReportProgress();
     }
 }