private ParallelMultiCountTableBuilder(IHostEnvironment env, MultiCountTable table, DataViewSchema.Column[] inputCols, long labelCardinality)
        {
            Contracts.AssertValue(env, nameof(env));
            env.AssertValue(table, nameof(table));
            _host = env.Register(RegistrationName);

            var n = table.ColCount;

            _host.Check(Utils.Size(inputCols) == n, "Inconsistent number of columns");
            _countTableBuilders = new InternalCountTableBuilderBase[n][];
            var slotCounts = table.SlotCount;

            for (int i = 0; i < _countTableBuilders.Length; i++)
            {
                var size = slotCounts[i];
                _host.Assert(size > 0);
                _host.Check(size == inputCols[i].Type.GetValueCount(), "Inconsistent number of slots");
                _countTableBuilders[i] = new InternalCountTableBuilderBase[size];

                for (int j = 0; j < size; j++)
                {
                    _countTableBuilders[i][j] = ((CountTableBase)table[i, j]).ToBuilder(labelCardinality);
                }
            }
        }
        public BagMultiCountTableBuilder(IHostEnvironment env, MultiCountTable table, DataViewSchema.Column[] inputCols, long labelCardinality)
        {
            Contracts.CheckValue(env, nameof(env));
            env.CheckValue(table, nameof(table));
            _host = env.Register(LoaderSignature);
            _host.Check(Utils.Size(inputCols) == table.ColCount, "Inconsistent number of columns");
            _host.Check(table.SlotCount.Zip(inputCols, (count, col) => (count, col)).
                        All(pair => pair.col.Type.GetValueCount() == pair.count), "Inconsistent number of slots");

            _builder   = table.BaseTable.ToBuilder(labelCardinality);
            _colCount  = table.ColCount;
            _slotCount = new int[_colCount];
            table.SlotCount.CopyTo(_slotCount, 0);
        }