private void loadDataButton_Click(object sender, EventArgs e) { textBox1.Text = ""; data = new Data[60, 2]; string[] paths = loadNames(); for (int i = 0; i < 60; i++) { data[i, 0] = new Data(); data[i, 1] = new Data(); data[i, 0].ReadDatasetLessX(paths[i], 0); data[i, 1].ReadDatasetLessX(paths[i], 1); } DataAnalysis DA = new DataAnalysis(ref data); DA.CalcWithoutDraw(); BinaryFormatter bf = new BinaryFormatter(); using (FileStream fs = File.Create("test10.bin")) bf.Serialize(fs, data); }
private void AnalysisButtonClick(object sender, EventArgs e) { DA = new DataAnalysis(ref data); DA.Show(); }
private void coupleButton_Click(object sender, EventArgs e) { textBox1.Text = ""; openFileDialog1.InitialDirectory = @"D:\YandexDisk\Программирование\GestureRecognize\GestureRecognize\EMG_2Chs\EMG-S1"; data = new Data[2, 2]; for (int i = 0; i < 2; i++) { data[i, 0] = new Data(); data[i, 1] = new Data(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { path[i] = openFileDialog1.FileName; } data[i, 0].ReadDatasetLessX(path[i], 0); data[i, 1].ReadDatasetLessX(path[i], 1); } DataAnalysis DA = new DataAnalysis(ref data); DA.CalcWithoutDraw(); //--------------------- alglib.clusterizerstate s; alglib.kmeansreport rep; int sets = 2, samples = 5000; int incNames = 1; while (true) { double[,] mass = DataToArray(sets, samples); alglib.clusterizercreate(out s); alglib.clusterizersetpoints(s, mass, 2); alglib.clusterizersetkmeanslimits(s, 5, 0); alglib.clusterizerrunkmeans(s, sets, out rep); if (rep.terminationtype == 1) { int[,] classRes = new int[sets, sets]; int pointsInSet = mass.GetLength(0) / sets; for (int n = 0; n < sets; n++) { for (int i = 0; i < pointsInSet; i++) { int r = rep.cidx[i + samples * n]; classRes[n, r]++; } } for (int i = 0; i < sets; i++) { for (int j = 0; j < sets; j++) { textBox1.Text += classRes[i, j].ToString() + "\t"; } textBox1.Text += Environment.NewLine; } textBox1.Text += Environment.NewLine; } else { textBox1.Text += rep.terminationtype.ToString(); } incNames++; if (incNames == 7) { break; } path[1] = path[1].Remove(path[1].Length - 5); path[1] = path[1].Insert(path[1].Length, incNames.ToString()); path[1] = path[1].Insert(path[1].Length, ".csv"); data[1, 0] = new Data(); data[1, 1] = new Data(); data[1, 0].ReadDatasetLessX(path[1], 0); data[1, 1].ReadDatasetLessX(path[1], 1); DA = new DataAnalysis(ref data); DA.CalcWithoutDraw(); } }