Esempio n. 1
0
        /// <summary>
        /// Splits the specified tree.
        /// </summary>
        /// <param name="tree">The tree.</param>
        /// <param name="gardener">The gardener.</param>
        /// <param name="testdata">The testdata.</param>
        private void Split(DecisionTree.Implementation.Tree tree, IGardener gardener, ITreeExampleData testdata)
        {
            tree.Split();

            if (this.PruneBox.IsChecked == true)
            {
                gardener.Prune(tree, testdata);
            }

            DecisionTreeWPFRenderer renderer = new DecisionTreeWPFRenderer(tree, this.TreeCanvas);

            renderer.Visualize();
        }
Esempio n. 2
0
        /// <summary>
        /// Handles the Click event of the RecalculateRegressionTreeButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void RecalculateRegressionTreeButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ExampleFactory factory = new ExampleFactory(this.GetDimension());
                this.tree = new MyRegressionTree(factory.GetCarExamples());
                IGardener gardener = new ReducedErrorPruningForRegressionTrees((MyRegressionTree)tree, 7);

                this.Split(tree, gardener, factory.GetCarTestSet());
            }
            catch (DecisionTree.Implementation.Exceptions.TreeException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Handles the Click event of the ImportButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void ImportButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Multiselect = false;
            openFileDialog.Filter      = "dat files (*.dat)|*.dat";
            DecisionTree.Implementation.Interfaces.ITreeSaver treeSaver = new BinaryTreeSaver();

            if (openFileDialog.ShowDialog() == true)
            {
                try
                {
                    this.tree = treeSaver.Import(openFileDialog.FileName);

                    DecisionTreeWPFRenderer renderer = new DecisionTreeWPFRenderer(tree, this.TreeCanvas);
                    renderer.Visualize();
                }
                catch (DecisionTree.Implementation.Exceptions.TreeException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }