コード例 #1
0
ファイル: NeuroNetsMainWindow.cs プロジェクト: juraam/SII
        private void btnUse_Click(object sender, EventArgs e)
        {
            int countInputNeurons  = dbHandler.SelectCountInputParametersInTask(lbTaskSelected.Text);
            int countOutputNeurons = 1;
            ActivateFunction af    = LibraryOfActivateFunctions.
                                     GetActivateFunction(dbHandler.SelectActivateFunctionTypeByNeuroNet(lbNetSelected.Text),
                                                         LibraryOfActivateFunctions.GetterParameter.TypeOfActivateFunctionName);
            List <double> valuesOfParametersAF = dbHandler.SelectValuesOfParametersOfAF(lbNetSelected.Text);
            int           k = 0;

            foreach (double item in valuesOfParametersAF)
            {
                af.SetValueOfParameter(k, item);
                k++;
            }

            int countNeurons = dbHandler.SelectCountNeuronsInNet(lbNetSelected.Text);

            bool[,] connections = new bool[countNeurons, countNeurons];
            double[,] weights   = new double[countNeurons, countNeurons];
            List <Tuple <int, int, double> > ls = dbHandler.SelectLearnedTopology(lbNetSelected.Text,
                                                                                  lbSelSelected.Text, LearningAlgorithmsLibrary.GetNameOfTypeOfAlgoritm(lbLASelected.Text));

            for (int i = 0; i < countNeurons; i++)
            {
                for (int j = 0; j < countNeurons; j++)
                {
                    connections[i, j] = false;
                    weights[i, j]     = 0.0;
                }
            }
            foreach (Tuple <int, int, double> item in ls)
            {
                connections[item.Item2, item.Item1] = true;
                weights[item.Item2, item.Item1]     = item.Item3;
            }
            int[]    neuronsInLayers = dbHandler.SelectNeuronsInLayers(lbNetSelected.Text);
            NeuroNet net             = new NeuroNet(countInputNeurons, countOutputNeurons, neuronsInLayers, connections, weights, af);

            NeuroNetSolvingWindow solvingWnd = new NeuroNetSolvingWindow(net);

            solvingWnd.Show();
        }
コード例 #2
0
        private void btnUse_Click(object sender, EventArgs e)
        {
            int countInputNeurons = dbHandler.SelectCountInputParametersInTask(lbTaskSelected.Text);
            int countOutputNeurons = 1;
            ActivateFunction af = LibraryOfActivateFunctions.
                GetActivateFunction(dbHandler.SelectActivateFunctionTypeByNeuroNet(lbNetSelected.Text),
                LibraryOfActivateFunctions.GetterParameter.TypeOfActivateFunctionName);
            List<double> valuesOfParametersAF = dbHandler.SelectValuesOfParametersOfAF(lbNetSelected.Text);
            int k = 0;
            foreach (double item in valuesOfParametersAF)
            {
                af.SetValueOfParameter(k, item);
                k++;
            }

            int countNeurons = dbHandler.SelectCountNeuronsInNet(lbNetSelected.Text);
            bool[,] connections = new bool[countNeurons, countNeurons];
            double[,] weights = new double[countNeurons, countNeurons];
            List<Tuple<int, int, double>> ls = dbHandler.SelectLearnedTopology(lbNetSelected.Text,
                lbSelSelected.Text, LearningAlgorithmsLibrary.GetNameOfTypeOfAlgoritm(lbLASelected.Text));
            for (int i = 0; i < countNeurons; i++)
            {
                for (int j = 0; j < countNeurons; j++)
                {
                    connections[i, j] = false;
                    weights[i, j] = 0.0;
                }
            }
            foreach (Tuple<int, int, double> item in ls)
            {
                connections[item.Item2, item.Item1] = true;
                weights[item.Item2, item.Item1] = item.Item3;
            }
            int[] neuronsInLayers = dbHandler.SelectNeuronsInLayers(lbNetSelected.Text);
            NeuroNet net = new NeuroNet(countInputNeurons, countOutputNeurons, neuronsInLayers, connections, weights, af);

            NeuroNetSolvingWindow solvingWnd = new NeuroNetSolvingWindow(net);
            solvingWnd.Show();
        }