예제 #1
0
 public void Update(IEnumerable <Tuple <double[], int> > points)
 {
     foreach (var tup in points)
     {
         data_.Add(new MemAccessor <double[]>(tup.Item1));
         labels_.Add(new MemAccessor <int>(tup.Item2));
     }
 }
예제 #2
0
        public Dataset(Dataset d)
        {
            data_   = new DSList <double[]>();
            labels_ = new DSList <int>();

            for (int i = 0; i < d.Count(); i++)
            {
                data_.Add(d.data_.GetAccessor(i));
                labels_.Add(d.labels_.GetAccessor(i));
            }
            labelCount_ = d.LabelCount();
        }
예제 #3
0
        public List <DSList <T> > CreateSplit(int[] counts)
        {
            List <DSList <T> > result = new List <DSList <T> >();

            int start = 0;

            for (int i = 0; i < counts.Length; i++)
            {
                DSList <T> data = new DSList <T>();
                for (int j = 0; j < counts[i]; j++)
                {
                    data.Add(GetAccessor(start + j));
                }
                result.Add(data);
                start += counts[i];
            }
            if (start != Count())
            {
                throw new Exception("Inconsistent dimensions!");
            }
            return(result);
        }
예제 #4
0
        public Dataset(String directory, int labelCount)
        {
            Console.WriteLine("Loading directory-based dataset.");
            Console.WriteLine("NB: (a) expecting a 'coordinates' text file (3 lines, height, width, channel)");
            Console.WriteLine("    (b) expecting a set of <id>.datum binary and <id>.label text file containing label");

            DirectoryInfo d = new DirectoryInfo(directory);

            data_   = new DSList <double[]>();
            labels_ = new DSList <int>();

            foreach (var file in d.GetFiles("*.datum"))
            {
                var    fa      = new BinDataAccessor(file.FullName);
                string labelfn = System.IO.Path.ChangeExtension(file.FullName, ".label");
                var    fl      = new TxtDataAccessor(labelfn);

                data_.Add(fa);
                labels_.Add(fl);
            }

            labelCount_ = labelCount;
        }