示例#1
0
        public ANNDataSet GetDataSet(bool randomizeData)
        {
            var ds = new ANNDataSet();
            var ls = new List <MetaColumn>();

            for (int i = 0; i < MetaData.Length; i++)
            {
                if (MetaData[i].IsIngored)
                {
                    continue;
                }
                else
                {
                    var c = new MetaColumn();
                    c.Id           = MetaData[i].Id;
                    c.Index        = MetaData[i].Index;
                    c.MissingValue = MetaData[i].MissingValue;
                    c.Name         = MetaData[i].Name;
                    c.Param        = MetaData[i].Param;
                    c.Scale        = MetaData[i].Scale;
                    c.Type         = MetaData[i].Type;
                    c.Encoding     = MetaData[i].Encoding;
                    ls.Add(c);
                }
            }

            //
            ds.MetaData         = ls.ToArray();
            ds.IsPrecentige     = IsPrecentige;
            ds.RowsToValidation = RowsToValidation;
            ds.RowsToTest       = RowsToTest;

            //
            List <List <string> > data = new List <List <string> >();

            for (int i = 0; i < this.Data.Count; i++)
            {
                //data[i] = new string[ds.MetaData.Length];
                var rowData = new List <string>();
                for (int j = 0; j < ds.MetaData.Length; j++)
                {
                    rowData.Add(this.Data[i][ds.MetaData[j].Index]);
                }
                data.Add(rowData);
            }

            if (randomizeData)
            {
                var rnd   = new Random((int)DateTime.UtcNow.Ticks);
                var data1 = data;
                var res1  = data1.OrderBy(row => rnd.Next());
                var res2  = res1.OrderBy(row => rnd.Next());
                data = res2.ToList();
            }

            ds.Data = data;
            return(ds);
        }
示例#2
0
        public ANNDataSet GetDataSet()
        {
            var ds = new ANNDataSet();

            ds.Data     = m_strData;
            ds.MetaData = GetMetadata();
            ds.TestRows = (m_testData == null || m_testData.Count == 0) ? 0 : m_testData[0].RowCount;
            return(ds);
        }
示例#3
0
        public ANNDataSet GetDataSet()
        {
            var ds = new ANNDataSet();

            ds.Data             = m_strData.Select(x => x.ToList()).ToList();
            ds.MetaData         = GetMetadata();
            ds.RowsToValidation = (m_testData == null || m_testData.Count == 0) ? 0 : m_testData[0].RowCount;
            return(ds);
        }
示例#4
0
 /// <summary>
 /// Create experiment based on Dataset
 /// </summary>
 /// <param name="dataset"></param>
 public Experiment(ANNDataSet dataset)
 {
     //copy data
     m_strData = new string[dataset.Data.Length][];
     for (int i = 0; i < dataset.Data.Length; i++)
     {
         m_strData[i] = new string[dataset.Data[i].Length];
         for (int j = 0; j < dataset.Data[i].Length; j++)
         {
             m_strData[i][j] = dataset.Data[i][j];
         }
     }
     //
     Init(dataset.MetaData.ToList(), dataset.TestRows, dataset.IsPrecentige);
 }
示例#5
0
 /// <summary>
 /// Create experiment based on Dataset
 /// </summary>
 /// <param name="dataset"></param>
 public DataFrame(ANNDataSet dataset)
 {
     //copy data
     m_strData = new string[dataset.Data.Count][];
     for (int i = 0; i < dataset.Data.Count; i++)
     {
         m_strData[i] = new string[dataset.Data[i].Count];
         for (int j = 0; j < dataset.Data[i].Count; j++)
         {
             m_strData[i][j] = dataset.Data[i][j];
         }
     }
     //
     Init(dataset.MetaData.ToList(), dataset.RowsToValidation, dataset.IsPrecentige);
 }