private static IDataView AppendLabelTransform(IHostEnvironment env, IChannel ch, IDataView input, string labelName, int labelPermutationSeed) { Contracts.AssertValue(env); env.AssertValue(ch); ch.AssertValue(input); ch.AssertNonWhiteSpace(labelName); var col = input.Schema.GetColumnOrNull(labelName); if (!col.HasValue) { throw ch.ExceptSchemaMismatch(nameof(input), "Label", labelName); } ColumnType labelType = col.Value.Type; if (!labelType.IsKey) { if (labelPermutationSeed != 0) { ch.Warning( "labelPermutationSeed != 0 only applies on a multi-class learning problem when the label type is a key."); } return(input); } return(Utils.MarshalInvoke(AppendFloatMapper <int>, labelType.RawType, env, ch, input, labelName, (KeyType)labelType, labelPermutationSeed)); }
private static IDataView AppendLabelTransform(IHostEnvironment env, IChannel ch, IDataView input, string labelName, int labelPermutationSeed) { Contracts.AssertValue(env); env.AssertValue(ch); ch.AssertValue(input); ch.AssertNonWhiteSpace(labelName); int col; if (!input.Schema.TryGetColumnIndex(labelName, out col)) { throw ch.Except("Label column '{0}' not found.", labelName); } ColumnType labelType = input.Schema[col].Type; if (!labelType.IsKey) { if (labelPermutationSeed != 0) { ch.Warning( "labelPermutationSeed != 0 only applies on a multi-class learning problem when the label type is a key."); } return(input); } return(Utils.MarshalInvoke(AppendFloatMapper <int>, labelType.RawType, env, ch, input, labelName, (KeyType)labelType, labelPermutationSeed)); }