internal override CountTableBase CreateCountTable() { var priorCounts = PriorCounts.Select(x => (float)x).ToArray(); var singleTables = new Dictionary <long, float> [LabelCardinality]; for (int iTable = 0; iTable < LabelCardinality; iTable++) { singleTables[iTable] = new Dictionary <long, float>(); } float[] garbageCounts = null; if (_garbageThreshold > 0) { ProcessGarbage(singleTables, out garbageCounts); } else { for (int iTable = 0; iTable < LabelCardinality; iTable++) { var dest = singleTables[iTable]; var src = _tables[iTable]; foreach (var pair in src) { dest[pair.Key] = (float)pair.Value; } } } return(new DictCountTable(singleTables, LabelCardinality, priorCounts, _garbageThreshold, garbageCounts)); }
internal override CountTableBase CreateCountTable() { var priorCounts = PriorCounts.Select(x => (float)x).ToArray(); // copying / converting tables var tables = new Dictionary <int, float> [LabelCardinality][]; for (int iLabel = 0; iLabel < LabelCardinality; iLabel++) { tables[iLabel] = new Dictionary <int, float> [_depth]; for (int iDepth = 0; iDepth < _depth; iDepth++) { tables[iLabel][iDepth] = new Dictionary <int, float>(); foreach (var kvp in _tables[iLabel][iDepth]) { tables[iLabel][iDepth].Add(kvp.Key, (float)kvp.Value); } } } return(new CMCountTable(tables, priorCounts, _depth, _width)); }