private void DrawLearningDataSetButton_Click(object sender, RoutedEventArgs e) { if (data != null) { ValuesA.Clear(); ValuesB.Clear(); ValuesC.Clear(); ValuesD.Clear(); data.ForEach(i => { switch (i.ObjClass) { case 0: ValuesA.Add(new ObservablePoint(i.Attributes[0], i.Attributes[1])); break; case 1: ValuesB.Add(new ObservablePoint(i.Attributes[0], i.Attributes[1])); break; } }); stolp.stolp(data, int.Parse(deltaTextBox.Text), int.Parse(l0TextBox.Text)).ForEach(i => { ValuesC.Add(new ObservablePoint(i.Attributes[0], i.Attributes[1])); }); List <Data> standarts = new List <Data>(); standarts.AddRange(stolp.findStandard(stolp.emissionСutOff(data, int.Parse(deltaTextBox.Text)))); //standarts.AddRange(stolp.findStandard(data)); standarts.ForEach(i => { ValuesD.Add(new ObservablePoint(i.Attributes[0], i.Attributes[1])); }); } }
private void ClassificateButton_Click(object sender, RoutedEventArgs e) { if (data != null) { ValuesA.Clear(); ValuesB.Clear(); ValuesC.Clear(); ValuesD.Clear(); List <Data> newData = new List <Data>(); List <Data> omega = stolp.stolp(data, int.Parse(deltaTextBox.Text), int.Parse(l0TextBox.Text)); int maxItemCount = int.Parse(count.Text); for (int i = 0; i < maxItemCount; i++) { for (int j = 0; j < maxItemCount; j++) { Data obj = new Data(new double[] { i / (double)maxItemCount, j / (double)maxItemCount }, -1); obj.ObjClass = stolp.classifier(omega, obj); switch (obj.ObjClass) { case 0: ValuesA.Add(new ObservablePoint(obj.Attributes[0], obj.Attributes[1])); break; case 1: ValuesB.Add(new ObservablePoint(obj.Attributes[0], obj.Attributes[1])); break; } newData.Add(obj); } } stolp.stolp(data, int.Parse(deltaTextBox.Text), int.Parse(l0TextBox.Text)).ForEach(i => { ValuesC.Add(new ObservablePoint(i.Attributes[0], i.Attributes[1])); }); List <Data> standarts = new List <Data>(); //standarts.AddRange(stolp.findStandard(data)); standarts.AddRange(stolp.findStandard(stolp.emissionСutOff(data, int.Parse(deltaTextBox.Text)))); standarts.ForEach(i => { ValuesD.Add(new ObservablePoint(i.Attributes[0], i.Attributes[1])); }); } else { MessageBox.Show("Сперва Выберите Файл c обучающей выборкой"); } /*data.ForEach(i => * { * switch (i.ObjClass) * { * case 0: ValuesA.Add(new ObservablePoint(i.Attributes[0], i.Attributes[1])); break; * case 1: ValuesB.Add(new ObservablePoint(i.Attributes[0], i.Attributes[1])); break; * } * }); * */ }