public void TrainingTestIndexSplit_Equals()
        {
            var sut = new TrainingTestIndexSplit(new int[] { 1, 2 }, new int[] { 3, 4 });

            var equal    = new TrainingTestIndexSplit(new int[] { 1, 2 }, new int[] { 3, 4 });
            var notEqual = new TrainingTestIndexSplit(new int[] { 3, 4 }, new int[] { 1, 2 });

            Assert.IsTrue(sut.Equals(equal));
            Assert.IsFalse(sut.Equals(notEqual));
        }
Esempio n. 2
0
        public void RandomTrainingTestIndexSplitter_Split()
        {
            var sut = new RandomTrainingTestIndexSplitter <double>(0.8, 42);

            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[] { 9, 0, 4, 2, 5, 7, 3, 8 },
                                                      new int[] { 1, 6 });

            Assert.AreEqual(expected, actual);
        }
        public void StratifiedTrainingTestIndexSplitter_Split()
        {
            var sut = new StratifiedTrainingTestIndexSplitter <double>(0.8);

            var targets = new double[] { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 };

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

            Assert.AreEqual(expected, actual);
        }
        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);
        }