public void NoShuffleTrainingValidationIndexSplitter_Split()
        {
            var sut = new NoShuffleTrainingTestIndexSplitter <double>(0.8);

            var targets = new double[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            var actual   = sut.Split(targets);
            var expected = new TrainingTestIndexSplit(new int[] { 0, 1, 2, 3, 4, 5, 6, 7 },
                                                      new int[] { 8, 9 });

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void TrainingTestIndexSplitterExtensions_SplitSet()
        {
            var observations = new F64Matrix(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 10, 1);
            var targets      = new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

            var splitter = new NoShuffleTrainingTestIndexSplitter <double>(0.6);

            var actual = splitter.SplitSet(observations, targets);

            var trainingIndices = Enumerable.Range(0, 6).ToArray();
            var testIndices     = Enumerable.Range(6, 4).ToArray();

            var expected = new TrainingTestSetSplit(
                new ObservationTargetSet((F64Matrix)observations.Rows(trainingIndices),
                                         targets.GetIndices(trainingIndices)),
                new ObservationTargetSet((F64Matrix)observations.Rows(testIndices),
                                         targets.GetIndices(testIndices)));

            Assert.AreEqual(expected, actual);
        }