Пример #1
0
 public DesisionTreeMainWindow()
 {
     InitializeComponent();
     dbHandler = new DataBaseHandler();
     desTreeInfo = new DataContainer<List<string[]>>();
     learningInfo = new DataContainer<DataContainer<List<string>>>();
     LoadInformationForUsingDesTrees();
 }
Пример #2
0
        public NeuroNetsMainWindow()
        {
            InitializeComponent();

            Type     ourtype = typeof(ActivateFunction); // Базовый тип
            Assembly ast     = Assembly.GetAssembly(ourtype);

            Type[]             types = ast.GetTypes();
            IEnumerable <Type> list  = Assembly.GetAssembly(ourtype).GetTypes().Where(type => type.IsSubclassOf(ourtype)); // using System.Linq
            List <Type>        aa    = new List <Type>(list);

            foreach (Type itm in aa)
            {
                ActivateFunction af1  = (ActivateFunction)Activator.CreateInstance(itm);
                string           name = af1.GetType().Name;
            }

            dbHandler     = new DataBaseHandler();
            neuroNetsInfo = new DataContainer <List <string[]> >();
            learningInfo  = new DataContainer <DataContainer <List <string> > >();

            dgwNeuroNets.ColumnHeadersDefaultCellStyle.Font = new Font("Book Antiqua", 9);
            dgwNeuroNets.Columns.Add("Name", "Имя");
            dgwNeuroNets.Columns.Add("TopologyTypeName", "Топология");
            dgwNeuroNets.Columns.Add("Task", "Задача");
            dgwNeuroNets.Columns.Add("NeuronCount", "Количество нейронов");
            dgwNeuroNets.Columns.Add("LayerCount", "Количество слоев");
            dgwNeuroNets.Columns.Add("ActivateFunction", "Активационная функция");

            dgwNeuronsInLayers.Columns.Add("Layer", "Слой");
            dgwNeuronsInLayers.Columns.Add("Neurons", "Число нейронов");

            dgwParamsAF.Columns.Add("Parameter", "Параметр");
            dgwParamsAF.Columns.Add("Value", "Значение");

            dgwNets.ColumnHeadersDefaultCellStyle.Font = new Font("Book Antiqua", 9);
            dgwNets.Columns.Add("NeuroNet", "Нейронная сеть");
            dgwNets.Columns.Add("TopologyTypeName", "Топология");
            dgwNets.Columns.Add("NeuronCount", "Количество нейронов");
            dgwNets.Columns.Add("LayerCount", "Количество слоев");

            dgwLA.ColumnHeadersDefaultCellStyle.Font = new Font("Book Antiqua", 9);
            dgwLA.Columns.Add("LearningAlgorithm", "Алгоритм обучения");
            dgwLA.Columns.Add("LearningStatus", "Статус обучения");

            LoadInformationForUsingNeuroNets();
            FillNeuroNetChangingTable();
        }
Пример #3
0
        public NeuroNetsMainWindow()
        {
            InitializeComponent();

            Type ourtype = typeof(ActivateFunction); // Базовый тип
            Assembly ast = Assembly.GetAssembly(ourtype);
            Type[] types = ast.GetTypes();
            IEnumerable<Type> list = Assembly.GetAssembly(ourtype).GetTypes().Where(type => type.IsSubclassOf(ourtype));  // using System.Linq
            List<Type> aa = new List<Type>(list);

            foreach (Type itm in aa)
            {
                ActivateFunction af1 = (ActivateFunction)Activator.CreateInstance(itm);
                string name = af1.GetType().Name;
            }

            dbHandler = new DataBaseHandler();
            neuroNetsInfo = new DataContainer<List<string[]>>();
            learningInfo = new DataContainer<DataContainer<List<string>>>();

            dgwNeuroNets.ColumnHeadersDefaultCellStyle.Font = new Font("Book Antiqua", 9);
            dgwNeuroNets.Columns.Add("Name", "Имя");
            dgwNeuroNets.Columns.Add("TopologyTypeName", "Топология");
            dgwNeuroNets.Columns.Add("Task", "Задача");
            dgwNeuroNets.Columns.Add("NeuronCount", "Количество нейронов");
            dgwNeuroNets.Columns.Add("LayerCount", "Количество слоев");
            dgwNeuroNets.Columns.Add("ActivateFunction", "Активационная функция");

            dgwNeuronsInLayers.Columns.Add("Layer", "Слой");
            dgwNeuronsInLayers.Columns.Add("Neurons", "Число нейронов");

            dgwParamsAF.Columns.Add("Parameter", "Параметр");
            dgwParamsAF.Columns.Add("Value", "Значение");

            dgwNets.ColumnHeadersDefaultCellStyle.Font = new Font("Book Antiqua", 9);
            dgwNets.Columns.Add("NeuroNet", "Нейронная сеть");
            dgwNets.Columns.Add("TopologyTypeName", "Топология");
            dgwNets.Columns.Add("NeuronCount", "Количество нейронов");
            dgwNets.Columns.Add("LayerCount", "Количество слоев");

            dgwLA.ColumnHeadersDefaultCellStyle.Font = new Font("Book Antiqua", 9);
            dgwLA.Columns.Add("LearningAlgorithm", "Алгоритм обучения");
            dgwLA.Columns.Add("LearningStatus", "Статус обучения");

            LoadInformationForUsingNeuroNets();
            FillNeuroNetChangingTable();
        }
Пример #4
0
        public AddChangeNeuroNetDialog(DataBaseHandler _dbHandler, NeuroNetDefinition neuro_def = null)
        {
            InitializeComponent();

            if (neuro_def == null)
                mode = form_destination.Creating;
            else
            {
                mode = form_destination.Editing;
                definition_of_editing_net = neuro_def;
            }

            dbHandler = _dbHandler;

            List<string> ls = dbHandler.SelectTasks();
            foreach (string par in ls)
            {
                cbTask.Items.Add(par);
            }

            ls = LibraryOfTopologies.GetAllTopologyTypeNames();
            foreach (string item in ls)
            {
                cbTopology.Items.Add(item);
            }

            string[] namesAF = LibraryOfActivateFunctions.GetAllActivateFunctionNames();
            for (int i = 0; i < LibraryOfActivateFunctions.GetCountActivateFunctions(); i++)
            {
                cbActivateFunction.Items.Add(namesAF[i]);
            }

            ls = dbHandler.SelectCountParametersInTasks();
            countInputParamsInTask = new int[ls.Count];
            for (int i = 0; i < ls.Count; i++)
            {
                countInputParamsInTask[i] = Convert.ToInt32(ls[i]);
            }

            dgwEditNeuronsInLayers.ColumnHeadersDefaultCellStyle.Font = new Font("Book Antiqua", 9);
            dgwEditNeuronsInLayers.Columns.Add("Layer", "Слой");
            dgwEditNeuronsInLayers.Columns.Add("Neurons", "Число нейронов");
            RefreshDgwNeuronsInLayers();

            dgwEditParametersAF.ColumnHeadersDefaultCellStyle.Font = new Font("Book Antiqua", 9);
            dgwEditParametersAF.Columns.Add("Parameter", "Параметр");
            dgwEditParametersAF.Columns.Add("Value", "Значение");

            switch (mode)
            {
                case form_destination.Creating:
                    Text = "Создание нейронной сети";
                    break;
                case form_destination.Editing:
                    Text = "Изменение Нейронной Сети";
                    tbNameNeuroNet.Text = definition_of_editing_net.Name;
                    for (int i = 0; i < cbTask.Items.Count; i++)
                    {
                        if (String.Compare(cbTask.Items[i].ToString(), definition_of_editing_net.TaskName) == 0)
                        {
                            cbTask.SelectedIndex = i;
                            break;
                        }
                    }
                    for (int i = 0; i < cbTopology.Items.Count; i++)
                    {
                        if (String.Compare(cbTopology.Items[i].ToString(), definition_of_editing_net.TopologyName) == 0)
                        {
                            cbTopology.SelectedIndex = i;
                            break;
                        }
                    }
                    if (cbTopology.SelectedIndex == -1)
                    {
                        MessageBox.Show("Топология, примененная в данной нейронной сети, " +
                        "не найдена. Она будет недоступна при изменении сети.");
                    }

                    numNeuronsNumber.Value = definition_of_editing_net.NeuronsCount;
                    numLayersNumber.Value = definition_of_editing_net.LayerCount;

                    for (int i = 0; i < definition_of_editing_net.LayerCount; i++)
                    {
                        dgwEditNeuronsInLayers.Rows[i].Cells[1].Value = definition_of_editing_net.NeuronsInLayer[i];
                    }

                    for (int i = 0; i < cbActivateFunction.Items.Count; i++)
                    {
                        if (String.Compare(cbActivateFunction.Items[i].ToString(), definition_of_editing_net.ActivateFunction) == 0)
                        {
                            cbActivateFunction.SelectedIndex = i;
                            break;
                        }
                    }

                    for (int i = 0; i < definition_of_editing_net.AFParameters.Length; i++)
                    {
                        dgwEditParametersAF.Rows[i].Cells[1].Value = definition_of_editing_net.AFParameters[i];
                    }
                    break;
            }
        }
Пример #5
0
        public AddChangeNeuroNetDialog(DataBaseHandler _dbHandler, NeuroNetDefinition neuro_def = null)
        {
            InitializeComponent();

            if (neuro_def == null)
            {
                mode = form_destination.Creating;
            }
            else
            {
                mode = form_destination.Editing;
                definition_of_editing_net = neuro_def;
            }

            dbHandler = _dbHandler;

            List <string> ls = dbHandler.SelectTasks();

            foreach (string par in ls)
            {
                cbTask.Items.Add(par);
            }

            ls = LibraryOfTopologies.GetAllTopologyTypeNames();
            foreach (string item in ls)
            {
                cbTopology.Items.Add(item);
            }

            string[] namesAF = LibraryOfActivateFunctions.GetAllActivateFunctionNames();
            for (int i = 0; i < LibraryOfActivateFunctions.GetCountActivateFunctions(); i++)
            {
                cbActivateFunction.Items.Add(namesAF[i]);
            }

            ls = dbHandler.SelectCountParametersInTasks();
            countInputParamsInTask = new int[ls.Count];
            for (int i = 0; i < ls.Count; i++)
            {
                countInputParamsInTask[i] = Convert.ToInt32(ls[i]);
            }

            dgwEditNeuronsInLayers.ColumnHeadersDefaultCellStyle.Font = new Font("Book Antiqua", 9);
            dgwEditNeuronsInLayers.Columns.Add("Layer", "Слой");
            dgwEditNeuronsInLayers.Columns.Add("Neurons", "Число нейронов");
            RefreshDgwNeuronsInLayers();

            dgwEditParametersAF.ColumnHeadersDefaultCellStyle.Font = new Font("Book Antiqua", 9);
            dgwEditParametersAF.Columns.Add("Parameter", "Параметр");
            dgwEditParametersAF.Columns.Add("Value", "Значение");

            switch (mode)
            {
            case form_destination.Creating:
                Text = "Создание нейронной сети";
                break;

            case form_destination.Editing:
                Text = "Изменение Нейронной Сети";
                tbNameNeuroNet.Text = definition_of_editing_net.Name;
                for (int i = 0; i < cbTask.Items.Count; i++)
                {
                    if (String.Compare(cbTask.Items[i].ToString(), definition_of_editing_net.TaskName) == 0)
                    {
                        cbTask.SelectedIndex = i;
                        break;
                    }
                }
                for (int i = 0; i < cbTopology.Items.Count; i++)
                {
                    if (String.Compare(cbTopology.Items[i].ToString(), definition_of_editing_net.TopologyName) == 0)
                    {
                        cbTopology.SelectedIndex = i;
                        break;
                    }
                }
                if (cbTopology.SelectedIndex == -1)
                {
                    MessageBox.Show("Топология, примененная в данной нейронной сети, " +
                                    "не найдена. Она будет недоступна при изменении сети.");
                }

                numNeuronsNumber.Value = definition_of_editing_net.NeuronsCount;
                numLayersNumber.Value  = definition_of_editing_net.LayerCount;

                for (int i = 0; i < definition_of_editing_net.LayerCount; i++)
                {
                    dgwEditNeuronsInLayers.Rows[i].Cells[1].Value = definition_of_editing_net.NeuronsInLayer[i];
                }

                for (int i = 0; i < cbActivateFunction.Items.Count; i++)
                {
                    if (String.Compare(cbActivateFunction.Items[i].ToString(), definition_of_editing_net.ActivateFunction) == 0)
                    {
                        cbActivateFunction.SelectedIndex = i;
                        break;
                    }
                }

                for (int i = 0; i < definition_of_editing_net.AFParameters.Length; i++)
                {
                    dgwEditParametersAF.Rows[i].Cells[1].Value = definition_of_editing_net.AFParameters[i];
                }
                break;
            }
        }