private static ValueMap Train(IExceptionContext ectx, BinaryLoader ldr) { Contracts.AssertValue(ectx); ectx.AssertValue(ldr); ectx.Assert(ldr.Schema.ColumnCount == 2); // REVIEW: Should we allow term to be a vector of text (each term in the vector // would map to the same value)? ectx.Assert(ldr.Schema.GetColumnType(0).IsText); var schema = ldr.Schema; var typeValue = schema.GetColumnType(1); // REVIEW: We should know the number of rows - use that info to set initial capacity. var values = ValueMap.Create(typeValue); using (var cursor = ldr.GetRowCursor(c => true)) values.Train(ectx, cursor, 0, 1); return(values); }