示例#1
0
文件: KNeural.cs 项目: dunghand/msrds
        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();
            }
        }
示例#2
0
        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();
                }
            }
        }
示例#3
0
文件: KNeural.cs 项目: dunghand/msrds
 public void AddKdata(KData data)
 {
     _Data.Add(data);
 }
示例#4
0
 public void AddKdata(KData data)
 {
     _Data.Add(data);
 }