Пример #1
0
        void ann()
        {
            listView1.Items.Clear();
            Random        r       = new Random(DateTime.Now.Millisecond);
            List <double> inputVs = new List <double>();
            int           times   = 0;

            while (times < 1000)
            {
                inputVs.Clear();
                if (randomInput)
                {
                    for (int i = 0; i < nInput; i++)
                    {
                        inputVs.Add(r.Next(5));
                    }
                }
                else
                {
                    inputVs.Add(di);
                    inputVs.Add(di + 1);
                    di++;
                    if (di == 3)
                    {
                        di = 0;
                    }
                }
                bool flag = net.Train(inputVs, alpha);
                ShowNet();
                if (flag)
                {
                    break;
                }
                times++;
            }
            MessageBox.Show(times.ToString());
        }
Пример #2
0
        private void TrainNetwork()
        {
            double error = 0;

            do
            {
                if (!pause)
                {
                    error = Net.Train();
                    epoche++;
                    //calls the UI-Thread for Updateing the Labels Content and ProgressBars Value
                    Dispatcher.Invoke(new Action(() =>
                    {
                        ErrorInformation.Content = "Iteration: " + epoche.ToString() + " | Error: " + Math.Round(error, 5).ToString();
                    }));
                }
            }while (error > minerr);
        }