Ejemplo n.º 1
0
        /// <summary>
        /// Constructs a new AnnDialog.
        /// </summary>
        public AnnDialog(ref Klu Klu)
        {
            InitializeComponent();

            _Klu = Klu;

            #region Initialize ANN stuff
            _ANN           = new ANN();
            _ANN.NumLayers = 3;
            _ANN.SetNumNeurons(0, 38);
            _ANN.SetNumNeurons(1, 6);
            _ANN.SetNumNeurons(2, 7);

            // Bind certain labels to ANN stuff
            AnnNumLayers.DataContext = _ANN;

            // Bind DataGrid to ANN-DataSet now
            _DataSet = new DataSet("HiddenLayer");
            _DataSet.Tables.Add("HiddenLayerTable");
            uint tmp = 0;
            _DataSet.Tables[0].Columns.Add("Neurons", tmp.GetType());
            tmp = 6;
            _DataSet.Tables[0].Rows.Add(tmp);
            HiddenLayerDataGrid.DataContext = _DataSet.Tables[0];
            #endregion
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Callback which takes the ANN DataSet for hidden layers and draws the ANN
        /// using the using the new hidden layers.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ApplyAnnSettings_Click(object sender, RoutedEventArgs e)
        {
            _ANN.NumLayers = 2 + _DataSet.Tables[0].Rows.Count;
            _ANN.SetNumNeurons(0, 16);
            _ANN.SetNumNeurons(_DataSet.Tables[0].Rows.Count + 1, 7);

            for (int i = 0; i < _DataSet.Tables[0].Rows.Count; i++)
            {
                _ANN.SetNumNeurons(i + 1, Convert.ToInt32(_DataSet.Tables[0].Rows[i].ItemArray[0]));
            }

            DrawANN();
        }
Ejemplo n.º 3
0
        public TrainingDialog(ref TrainingDataSet dataSet)
        {
            InitializeComponent();

            _BackgroundWorker = new BackgroundWorker();
            _BackgroundWorker.WorkerReportsProgress      = true;
            _BackgroundWorker.WorkerSupportsCancellation = true;
            _BackgroundWorker.DoWork             += new DoWorkEventHandler(DoWork);
            _BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(RunWorkerCompleted);
            _BackgroundWorker.ProgressChanged    += new ProgressChangedEventHandler(ProgressChanged);

            _DataSet = dataSet;

            _Chart = new Chart();
            windowsFormsHost1.Child = _Chart;

            _Series = 0;

            StopButton.IsEnabled = false;

            _Network = new ActivationNetwork(
                new SigmoidFunction(),
                _NumInputNeurons,
                9,
                _NumOutputNeurons
                );

            #region Initialize ANN stuff
            _ANN           = new ANN();
            _ANN.NumLayers = 3;
            _ANN.SetNumNeurons(0, _NumInputNeurons);
            _ANN.SetNumNeurons(1, 9);
            _ANN.SetNumNeurons(2, _NumOutputNeurons);

            // Bind DataGrid to ANN-DataSet now
            _DataSetANN = new DataSet("HiddenLayer");
            _DataSetANN.Tables.Add("HiddenLayerTable");
            uint tmp = 9;
            _DataSetANN.Tables[0].Columns.Add("Neurons", tmp.GetType());
            _DataSetANN.Tables[0].Rows.Add(tmp);
            HiddenLayerDataGrid.DataContext = _DataSetANN.Tables[0];
            #endregion
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Callback which takes the ANN DataSet for hidden layers and draws the ANN
        /// using the using the new hidden layers.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ApplyAnnSettings_Click(object sender, RoutedEventArgs e)
        {
            _ANN.NumLayers = 2 + _DataSetANN.Tables[0].Rows.Count;
            _ANN.SetNumNeurons(0, 38);
            _ANN.SetNumNeurons(_DataSetANN.Tables[0].Rows.Count + 1, _NumOutputNeurons);

            int[] neuronsCount = new int[_DataSetANN.Tables[0].Rows.Count + 1];
            neuronsCount[neuronsCount.GetLength(0) - 1] = _NumOutputNeurons;

            for (int i = 0; i < _DataSetANN.Tables[0].Rows.Count; i++)
            {
                int neuronCount = Convert.ToInt32(_DataSetANN.Tables[0].Rows[i].ItemArray[0]);

                neuronsCount[i] = neuronCount;

                _ANN.SetNumNeurons(i + 1, neuronCount);
            }

            _Network = new ActivationNetwork(new SigmoidFunction(_SigmoidAlpha), _NumInputNeurons, neuronsCount);

            DrawANN();
        }