private void button4_Click(object sender, EventArgs e) { button2.Enabled = false; label2.Enabled = false; numericUpDown1.Enabled = false; button3.Enabled = false; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "Files|*.dat"; DialogResult result = openFileDialog1.ShowDialog(); BinaryFormatter formatter = new BinaryFormatter(); if (result == DialogResult.OK) { using (FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open)) { ExternalForest extForest = (ExternalForest)formatter.Deserialize(fs); forest = extForest.forest; codifier = extForest.codifier; attributes = extForest.attributes; target_attribute = extForest.target_attribute; } ForestForm forest_form = new ForestForm(this); forest_form.Show(); forest_form.label1.Text = "The forest loaded!"; } }
private void button3_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; this.Enabled = false; forest = new DecisionForest(instances, target_attribute, attributes, Convert.ToInt32(numericUpDown1.Text)); this.Enabled = true; this.Cursor = Cursors.Default; ForestForm forest_form = new ForestForm(this); forest_form.Show(); forest_form.label1.Text = "The forest has been built!"; forest_form.label1.Text += "\nF-Measure is " + Math.Round(Analysis.FMeasure(instances, forest, target_attribute), 2); }