// Update data in list view private void UpdateDataListView( ) { // remove all curent data and columns dataList.Items.Clear( ); dataList.Columns.Clear( ); // add columns for (int i = 0, n = _Neural._Data[0]._InputList.Count; i < n; i++) { dataList.Columns.Add(string.Format("X{0}", i + 1), 50, HorizontalAlignment.Left); } dataList.Columns.Add("Class", 50, HorizontalAlignment.Left); // add items for (int i = 0; i < _Neural._Data.Count; i++) { KData d = _Neural._Data[i]; for (int j = 0; j < d._InputList.Count; j++) { if (j == 0) { dataList.Items.Add(d._InputList[j]); } else { dataList.Items[i].SubItems.Add(d._InputList[j]); } } dataList.Items[i].SubItems.Add(d._Output); } }
public void LoadData() { StreamReader reader = null; // temp buffers (for 50 samples only) // min and max X values // samples count try { string str = null; // open selected file reader = File.OpenText(Directory.GetCurrentDirectory() + @"\Data Samples\gamedata.csv"); // read the data while ((str = reader.ReadLine()) != null) { KData data = new KData(); // split the string string[] strs = str.Split(';'); if (strs.Length == 1) strs = str.Split(','); // allocate data array // parse data for (int j = 0; j < strs.Length - 1; j++) { data._InputList.Add( strs[j]); } data._Output = strs[strs.Length - 1]; _Data.Add(data); //// search for min value //if (tempData[samples, 0] < minX) // minX = tempData[samples, 0]; //// search for max value //if (tempData[samples, 0] > maxX) // maxX = tempData[samples, 0]; } // clear current result } catch (Exception) { } finally { // close file if (reader != null) reader.Close(); } }
public void AddKdata(KData data) { _Data.Add(data); }
public void LoadData() { StreamReader reader = null; // temp buffers (for 50 samples only) // min and max X values // samples count try { string str = null; // open selected file reader = File.OpenText(Directory.GetCurrentDirectory() + @"\Data Samples\gamedata.csv"); // read the data while ((str = reader.ReadLine()) != null) { KData data = new KData(); // split the string string[] strs = str.Split(';'); if (strs.Length == 1) { strs = str.Split(','); } // allocate data array // parse data for (int j = 0; j < strs.Length - 1; j++) { data._InputList.Add(strs[j]); } data._Output = strs[strs.Length - 1]; _Data.Add(data); //// search for min value //if (tempData[samples, 0] < minX) // minX = tempData[samples, 0]; //// search for max value //if (tempData[samples, 0] > maxX) // maxX = tempData[samples, 0]; } // clear current result } catch (Exception) { } finally { // close file if (reader != null) { reader.Close(); } } }