private void Button_Click(object sender, RoutedEventArgs e) { var tag = int.Parse((KFolds.SelectedItem as ComboBoxItem).Tag.ToString()); if (tag == 0) { treeComboBox.Items.Clear(); var tree = new DecisionTree(); tree.Train(X, y); trees = new List <DecisionTree>(); trees.Add(tree); var item = new ComboBoxItem(); item.Content = "0"; item.Tag = "0"; treeComboBox.Items.Clear(); treeComboBox.Items.Add(item); treeComboBox.SelectedIndex = 0; } else { int K = tag; trees = KFoldTest(X, y, K, true); treeComboBox.Items.Clear(); for (int i = 0; i < K; i++) { var item = new ComboBoxItem(); item.Content = i.ToString(); item.Tag = i.ToString(); treeComboBox.Items.Add(item); } treeComboBox.SelectedIndex = 0; } }
public MainWindow() { InitializeComponent(); GetData("divorce.csv", out X, out y, out string[] Xlabel, out string[] ylabel); // veriseti randomizasyonu * kfold dan once var bytes = new byte[y.Length]; new Random().NextBytes(bytes); var bytesC = (byte[])bytes.Clone(); Array.Sort(bytes, X); Array.Sort(bytesC, y); KFoldTest(X, y, 20); KFoldTest(X, y, 10); KFoldTest(X, y, 5); KFoldTest(X, y, 3); KFoldTest(X, y, 2); tree = new DecisionTree(); tree.Train(X, y); questionList = new List <Question>(); for (int i = 0; i < Xlabel.Length; i++) { var q = new Question(i, Xlabel[i]); questionList.Add(q); xlist.Items.Add(q); } xtree.Items.Add(tree.rootNode); }