Example #1
0
        private void btnBuild_Click(object sender, EventArgs e)
        {
            List <string> columnsInConsideration = new List <string>();

            for (int i = 0; i < checkedListBox1.Items.Count; i++)
            {
                if (checkedListBox1.GetItemCheckState(i) == CheckState.Checked)
                {
                    columnsInConsideration.Add(checkedListBox1.Items[i].ToString());
                }
            }

            double entropie;

            if (!double.TryParse(txtEpsilon.Text, out entropie))
            {
                MessageBox.Show("Entropie format est pas valide");
                return;
            }
            if (entropie < 0 || entropie > 1)
            {
                MessageBox.Show("Entropie doit etre entre 0 et 1");
                return;
            }

            TrainingRatio ratio = TrainingRatio.T1_E1;

            if (rb11.Checked)
            {
                ratio = TrainingRatio.T1_E1;
            }
            if (rb21.Checked)
            {
                ratio = TrainingRatio.T2_E1;
            }
            if (rb31.Checked)
            {
                ratio = TrainingRatio.T3_E1;
            }
            if (rb41.Checked)
            {
                ratio = TrainingRatio.T4_E1;
            }
            if (rb12.Checked)
            {
                ratio = TrainingRatio.T1_E2;
            }
            if (rb13.Checked)
            {
                ratio = TrainingRatio.T1_E3;
            }
            if (rb14.Checked)
            {
                ratio = TrainingRatio.T1_E4;
            }
            if (rb23.Checked)
            {
                ratio = TrainingRatio.T2_E3;
            }
            if (rb34.Checked)
            {
                ratio = TrainingRatio.T3_E4;
            }


            Logger.BringToFront();

            _drugDataset.CleanAllColumns();

            DecisionTree decisionTree = new DecisionTree(_drugDataset, columnsInConsideration, entropie, ratio);

            _tree = decisionTree.RunTraining();

            lblTree.ForeColor = Color.Green;
            lblTree.Text      = _tree.Name + "( non sauvegardé )";

            ShowTreeInfo();
            tabControl1.SelectedTab = tabPage3;
        }