public ListDataSet ReadFile(string path, ClassificationClass cc)
        {
            path = path.TrimEnd('\\').TrimEnd('/') + "\\";
            DirectoryInfo dirInfo = new DirectoryInfo(path);

            FileInfo[] fileInfo = dirInfo.GetFiles("*.txt");

            ListDataSet dataSetList = new ListDataSet();

            foreach (FileInfo fi in fileInfo)
            {
                string className = fi.Name.Split('.')[0];
                cc.Add(className);
                StreamReader reader = new StreamReader(path + fi.Name);
                List <float> attr   = new List <float>();

                while (!reader.EndOfStream)
                {
                    attr.Add(float.Parse(reader.ReadLine()));
                }

                DataSet ds = new DataSet(attr.Count);
                ds.ClassName = className;
                for (int i = 0; i < attr.Count; i++)
                {
                    ds[i] = attr[i];
                }

                dataSetList.Add(ds);
            }

            return(dataSetList);
        }
示例#2
0
 public void Initialise(NeuralNetwork nn, ListDataSet dsl, ClassificationClass cc)
 {
     feedForward = new FeedForward();
     feedForward.Initialise(nn, dsl);
     classificationClass = cc;
 }
 public void Initialize(ListDataSet lds, ClassificationClass cc)
 {
     listDataSet         = lds;
     classificationClass = cc;
 }