Exemple #1
0
        static DataSet<Vector, Vector> LoadDataSet(string trainImagesPath, string trainLabelsPath, string testImagesPath, string testLabelsPath)
        {
            var trainDataSet   = Load(trainImagesPath, trainLabelsPath);
            GC.Collect();
            testDataSet    = Load (testImagesPath, testLabelsPath);
            GC.Collect();

            Console.WriteLine("Normalize data");
            var inputsNormalizator = new Normalization(trainDataSet.Inputs.ToArray());
            trainDataSet.TransformInputs(inputsNormalizator.Normalize);
            testDataSet.TransformInputs(inputsNormalizator.Normalize);

            return trainDataSet;
        }
Exemple #2
0
        static void LoadDataSet(string trainImagesPath, string trainLabelsPath, string testImagesPath, string testLabelsPath)
        {
            trainDataSet = Load(trainImagesPath, trainLabelsPath).Take(60000);
            GC.Collect();

            testDataSet  = Load(testImagesPath, testLabelsPath).Take(10000);
            GC.Collect();

            Console.WriteLine("Normalize data");
            Vector[] vectors = trainDataSet.Inputs.Select(x => x.ToVector).ToArray();
            var inputsNormalizator = new Normalization(vectors);

            foreach (var input in trainDataSet.Inputs)
                inputsNormalizator.Normalize(input.ToVector);

            foreach (var input in testDataSet.Inputs)
                inputsNormalizator.Normalize(input.ToVector);

            //Func<Matrix, Matrix> shifter = x => Deformation.Shift(x, 1, 1);
            //Func<Matrix, Matrix> distorter = x => Deformation.Distortion(x, 19, 19, 2, 5);

            //var expandedSet = trainDataSet.Inputs.Select(distorter);
            //var expandedSet = trainDataSet.Inputs;

            //trainDataSet = new DataSet<Matrix, Vector>(
            //	expandedSet.Concat(trainDataSet.Inputs).ToArray(),
            //	trainDataSet.Outputs.Concat(trainDataSet.Outputs).ToArray());
        }
Exemple #3
0
        static void LoadDataSet(string trainImagesPath, string trainLabelsPath)
        {
            var dataSet = Load(trainImagesPath, trainLabelsPath).Take(2500);
            GC.Collect();

            Console.WriteLine("Normalize data");
            Vector[] vectors = dataSet.Inputs.Select(x => x.ToVector).ToArray();
            var inputsNormalizator = new Normalization(vectors);

            foreach (var input in dataSet.Inputs)
                inputsNormalizator.Normalize(input.ToVector);

            trainDataSet = dataSet.Take(0, 80);
            testDataSet  = dataSet.Take(80, 100);
        }