private void btnLoad_Click(object sender, EventArgs e) { //kmeansForm.randomMark = "n"; if (Kval == String.Empty) { MessageBox.Show("Please specify a K value."); return; }//end if if (this.comboBox1.SelectedItem == null) { MessageBox.Show("Please select a data source."); return; }//if string datasource = this.comboBox1.SelectedItem.ToString(); DataSourceBLL dsBLL = new DataSourceBLL(); trainingDtos = dsBLL.process(datasource); if (DialogResult.Yes == MessageBox.Show("Does your file have headers?", "File import", MessageBoxButtons.YesNo)) { trainingDtos.RemoveAt(0); } StringBuilder sb; sb = NewKmeans.kmeanst(trainingDtos); this.dataGridView1.DataSource = NewKmeans._points; this.txtData.Text = sb.ToString(); }
private void btnStart_Click(object sender, EventArgs e) { NewKmeans kmeans = new NewKmeans(); StringBuilder sb = NewKmeans.kmeanstoo(); this.txtData.Text = sb.ToString(); List <NewKmeans.XY> dsList = new List <NewKmeans.XY>(); dsList = NewKmeans.CreateDataSet(); String listds = String.Empty; foreach (NewKmeans.XY XY in dsList) { listds += "(" + XY.XToString + " " + XY.YToString + ") , "; }//end foreach //this.txtData.Text = listds; this.dataGridView1.DataSource = dsList; }
private void btnLoad_Click(object sender, EventArgs e) { if (this.comboBox1.SelectedItem == null) { MessageBox.Show("Please select a data source."); return; }//if string datasource = this.comboBox1.SelectedItem.ToString(); DataSourceBLL dsBLL = new DataSourceBLL(); trainingDtos = dsBLL.process(datasource); if (DialogResult.Yes == MessageBox.Show("Does your file have headers?", "File import", MessageBoxButtons.YesNo)) { trainingDtos.RemoveAt(0); } /*NewKmeans kmeans2 = new NewKmeans(); * StringBuilder sb2 = kmeans2.kmeanst(trainingDtos); * * this.txtData.Text = sb2.ToString(); * * List<NewKmeans.XY> dsList = new List<NewKmeans.XY>(); * * dsList = kmeans2.Data(trainingDtos); * * String listds = String.Empty; * foreach (NewKmeans.XY XY in dsList) * { * * listds += "(" + XY.XToString + " " + XY.YToString + ") , "; * * }//end foreach */ //NewKmeans k = new NewKmeans(); List <NewKmeans.XY> points; points = NewKmeans.Data(trainingDtos); String listp = String.Empty; foreach (NewKmeans.XY p in points) { listp += "(" + p.XToString + ", " + p.YToString + ")"; this.textBox1.Text = listp; }//end foreach this.dataGridView1.DataSource = points; StringBuilder sb = NewKmeans.kmeanst(trainingDtos); this.txtData.Text = sb.ToString(); }