private void zoo_example()
        {
            string path = @"zoo.txt";

            Headers = new string[] {
                "Hair", "Feathers", "Eggs", "Milk", "Airborne", "Aquatic",
                "Predator", "Toothed", "Backbone", "Breathes", "Venomous", "Fins", "Legs", "Tail",
                "Domestic", "Catsize"
            };
            Result = "Animal type";

            List <string[]> rows  = new List <string[]>();
            List <string[]> dummy = new List <string[]>();

            foreach (var animalData in File.ReadAllLines(path))
            {
                List <string> data = new List <string>();
                string[]      line = animalData.Split(',');
                for (int i = 0; i < line.Length; ++i)
                {
                    if (i == 13 || i == 17 || i == 0)
                    {
                        data.Add(line[i]);
                    }
                    else
                    {
                        data.Add(BoolParser.Parse(line[i]).ToString());
                    }
                }
                dummy.Add(data.ToArray());
                data.RemoveAt(0);
                rows.Add(data.ToArray());
            }
            UpdateDataBaseZoo(dummy);
            tcMain.Clear();
            tree = DecisionTreeTools.BuildTree(rows);
            DecisionTreeTools.Prune(tree.NextFalseNode.NextTrueNode.NextFalseNode.NextTrueNode, 1.01);
            DecisionTreeTools.Prune(tree.NextFalseNode.NextTrueNode.NextTrueNode.NextFalseNode, 1.01);
            PrintTree(tree);


            listBoxZoo.Items.Clear();
            listBoxZoo.Items.Add(
                "1 -- (41) aardvark, antelope, bear, boar, buffalo, calf, cavy, cheetah, deer, dolphin, elephant, fruitbat, giraffe, girl, goat, gorilla, hamster, hare, leopard, lion, lynx, mink, mole, mongoose, opossum, oryx, platypus, polecat, pony, porpoise, puma, pussycat, raccoon, reindeer, seal, sealion, squirrel, vampire, vole, wallaby,wolf ");
            listBoxZoo.Items.Add(
                "2 -- (20) chicken, crow, dove, duck, flamingo, gull, hawk, kiwi, lark, ostrich, parakeet, penguin, pheasant, rhea, skimmer, skua, sparrow, swan, vulture, wren ");
            listBoxZoo.Items.Add("3 -- (5) pitviper, seasnake, slowworm, tortoise, tuatara");
            listBoxZoo.Items.Add(
                "4 -- (13) bass, carp, catfish, chub, dogfish, haddock, herring, pike, piranha, seahorse, sole, stingray, tuna ");
            listBoxZoo.Items.Add("5 -- (4) frog, frog, newt, toad ");
            listBoxZoo.Items.Add("6 -- (8) flea, gnat, honeybee, housefly, ladybird, moth, termite, wasp ");
            listBoxZoo.Items.Add(
                "7 -- (10) clam, crab, crayfish, lobster, octopus, scorpion, seawasp, slug, starfish, worm");

            listBoxZoo.Visibility = Visibility.Visible;
        }
        private void dataGridClassify_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                var           selectedRow = dataGridClassify.GetSelectedRow();
                List <string> data        = new List <string>();
                // StringBuilder str = new StringBuilder();
                for (int i = 0; i < dataGridClassify.Columns.Count; ++i)
                {
                    TextBlock textBlock = dataGridClassify.GetCell(selectedRow, i).Content as TextBlock;

                    if (textBlock != null)
                    {
                        //str.Append((textBlock.Text == string.Empty?"null":textBlock.Text)+"\n");
                        data.Add(textBlock.Text == string.Empty ? null : (textBlock.Text == "+")?"True":"False");
                    }
                    else
                    {
                        CheckBox checkBox = dataGridClassify.GetCell(selectedRow, i).Content as CheckBox;
                        if (checkBox != null)
                        {
                            data.Add(checkBox.IsChecked.ToString());
                            //str.Append(checkBox.IsChecked.ToString()+"\n");
                        }
                        else
                        {
                            var x = dataGridClassify.GetCell(selectedRow, i).Content as TextBox;
                            data.Add(x.Text);
                        }
                    }
                }
                var           classification     = DecisionTreeTools.MissingDataClassify(data.ToArray(), tree);
                StringBuilder classificationData = new StringBuilder();
                foreach (var c in classification)
                {
                    classificationData.Append("{" + Result + " '" + c.Key + "' : " + c.Value + "}");
                }

                MessageBox.Show(classificationData.ToString());
            }
        }
        private void simple_example()
        {
            string path = @"decision_tree_example.txt";

            Headers = new string[] { "Refferer", "Location", "Read FAQ", "Pages viewed" };
            Result  = "Service";

            List <string[]> rows = new List <string[]>();

            foreach (var word in File.ReadAllLines(path))
            {
                rows.Add(word.Split('\t'));
            }

            tcMain.Clear();
            tree = DecisionTreeTools.BuildTree(rows);
            PrintTree(tree);
            UpdateDataBaseSimpleExample(rows);

            listBoxZoo.Visibility = Visibility.Hidden;
        }