public void TestGroupedCheckOk()
        {
            LabeledDataset <int, int> testSet, trainSet;
            LabeledDataset <int, int> ld = NewData(new[, ] {
                { 1, 10 }, { 2, 1 }
            });

            ld.SplitForStratifiedCrossValidation(2, 1, out trainSet, out testSet);

            ld = NewData(new[, ] {
                { 1, 10 }, { 2, 1 }, { 1, 1 }
            });
            ld.GroupLabels(true);
            ld.SplitForStratifiedCrossValidation(2, 1, out trainSet, out testSet);

            ld = NewData(new[, ] {
                { 1, 10 }, { 2, 1 }, { 1, 1 }, { 2, 10 }
            });
            ld.GroupLabels(true);
            ld.SplitForStratifiedCrossValidation(2, 1, out trainSet, out testSet);
        }
        private static LabeledDataset <int, int> NewData(int[,] labelCounts, bool sortShuffled = false)
        {
            var result = new LabeledDataset <int, int>();

            for (int i = 0, k = 1; i <= labelCounts.GetUpperBound(0); i++)
            {
                int label = labelCounts[i, 0], count = labelCounts[i, 1];
                for (int j = 0; j < count; j++)
                {
                    result.Add(label, k++);
                }
            }
            if (sortShuffled)
            {
                result.GroupLabels(true);
            }
            return(result);
        }