3 instantiations of ValueToKeyMappingEstimator
Microsoft.ML.Data (3)
Transforms\ConversionsExtensionsCatalog.cs (3)
254=> new ValueToKeyMappingEstimator(CatalogUtils.GetEnvironment(catalog), 292return new ValueToKeyMappingEstimator(env, columnOptions, keyData); 309=> new ValueToKeyMappingEstimator(CatalogUtils.GetEnvironment(catalog), columns, keyData);
156 references to ValueToKeyMappingEstimator
Microsoft.ML.Core.Tests (1)
UnitTests\TestEntryPoints.cs (1)
1557data = new ValueToKeyMappingEstimator(Env, "Label", "Label", keyOrdinality: ValueToKeyMappingEstimator.KeyOrdinality.ByValue).Fit(data).Transform(data);
Microsoft.ML.Data (48)
Transforms\ConversionsExtensionsCatalog.cs (23)
126/// <see cref="MapValueToKey(TransformsCatalog.ConversionTransforms, InputOutputColumnPair[], int, ValueToKeyMappingEstimator.KeyOrdinality, bool, IDataView)"/></remarks> 147/// <see cref="MapValueToKey(TransformsCatalog.ConversionTransforms, InputOutputColumnPair[], int, ValueToKeyMappingEstimator.KeyOrdinality, bool, IDataView)"/></remarks> 223/// Create a <see cref="ValueToKeyMappingEstimator"/>, which converts categorical values into numerical keys. 232/// If set to <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByOccurrence"/>, keys are assigned in the order encountered. 233/// If set to <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByValue"/>, values are sorted, and keys are assigned based on the sort order.</param> 247public static ValueToKeyMappingEstimator MapValueToKey(this TransformsCatalog.ConversionTransforms catalog, 250int maximumNumberOfKeys = ValueToKeyMappingEstimator.Defaults.MaximumNumberOfKeys, 251ValueToKeyMappingEstimator.KeyOrdinality keyOrdinality = ValueToKeyMappingEstimator.Defaults.Ordinality, 252bool addKeyValueAnnotationsAsText = ValueToKeyMappingEstimator.Defaults.AddKeyValueAnnotationsAsText, 255new[] { new ValueToKeyMappingEstimator.ColumnOptions(outputColumnName, inputColumnName, maximumNumberOfKeys, keyOrdinality, addKeyValueAnnotationsAsText) }, keyData); 258/// Create a <see cref="ValueToKeyMappingEstimator"/>, which converts categorical values into keys. 267/// If set to <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByOccurrence"/>, keys are assigned in the order encountered. 268/// If set to <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByValue"/>, values are sorted, and keys are assigned based on the sort order.</param> 282public static ValueToKeyMappingEstimator MapValueToKey(this TransformsCatalog.ConversionTransforms catalog, 284int maximumNumberOfKeys = ValueToKeyMappingEstimator.Defaults.MaximumNumberOfKeys, 285ValueToKeyMappingEstimator.KeyOrdinality keyOrdinality = ValueToKeyMappingEstimator.Defaults.Ordinality, 286bool addKeyValueAnnotationsAsText = ValueToKeyMappingEstimator.Defaults.AddKeyValueAnnotationsAsText, 291var columnOptions = columns.Select(x => new ValueToKeyMappingEstimator.ColumnOptions(x.OutputColumnName, x.InputColumnName, maximumNumberOfKeys, keyOrdinality, addKeyValueAnnotationsAsText)).ToArray(); 296/// Create a <see cref="ValueToKeyMappingEstimator"/>, which converts value types into keys, optionally loading the keys to use from <paramref name="keyData"/>. 307internal static ValueToKeyMappingEstimator MapValueToKey(this TransformsCatalog.ConversionTransforms catalog, 308ValueToKeyMappingEstimator.ColumnOptions[] columns, IDataView keyData = null)
Transforms\ValueToKeyMappingEstimator.cs (8)
45/// <seealso cref="ConversionsExtensionsCatalog.MapValueToKey(TransformsCatalog.ConversionTransforms, InputOutputColumnPair[], int, ValueToKeyMappingEstimator.KeyOrdinality, bool, IDataView)"/> 46/// <seealso cref="ConversionsExtensionsCatalog.MapValueToKey(TransformsCatalog.ConversionTransforms, string, string, int, ValueToKeyMappingEstimator.KeyOrdinality, bool, IDataView)"/> 119/// If set to <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByOccurrence"/>, keys are assigned in the order encountered. 120/// If set to <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByValue"/>, values are sorted, and keys are assigned based on the sort order.</param> 138/// Initializes a new instance of <see cref="ValueToKeyMappingEstimator"/>. 145/// If set to <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByOccurrence"/>, keys are assigned in the order encountered. 146/// If set to <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByValue"/>, values are sorted, and keys are assigned based on the sort order.</param> 155_host = env.Register(nameof(ValueToKeyMappingEstimator));
Transforms\ValueToKeyMappingTransformer.cs (13)
38/// <see cref="ITransformer"/> resulting from fitting a <see cref="ValueToKeyMappingEstimator"/>. 56public ValueToKeyMappingEstimator.KeyOrdinality? Sort; 100public int MaxNumTerms = ValueToKeyMappingEstimator.Defaults.MaximumNumberOfKeys; 125public ValueToKeyMappingEstimator.KeyOrdinality Sort = ValueToKeyMappingEstimator.Defaults.Ordinality; 212private static (string outputColumnName, string inputColumnName)[] GetColumnPairs(ValueToKeyMappingEstimator.ColumnOptionsBase[] columns) 246params ValueToKeyMappingEstimator.ColumnOptions[] columns) : 251ValueToKeyMappingEstimator.ColumnOptionsBase[] columns, IDataView keyData, bool autoConvert) 274var cols = new ValueToKeyMappingEstimator.ColumnOptions[options.Columns.Length]; 283if (!Enum.IsDefined(typeof(ValueToKeyMappingEstimator.KeyOrdinality), options.Sort)) 290if (!Enum.IsDefined(typeof(ValueToKeyMappingEstimator.KeyOrdinality), sortOrder)) 293cols[i] = new ValueToKeyMappingEstimator.ColumnOptions( 515IDataView keyData, ValueToKeyMappingEstimator.ColumnOptionsBase[] columns, IDataView trainingData, bool autoConvert)
Transforms\ValueToKeyMappingTransformerImpl.cs (4)
42public static Builder Create(DataViewType type, ValueToKeyMappingEstimator.KeyOrdinality sortOrder) 50Contracts.Assert(sortOrder == ValueToKeyMappingEstimator.KeyOrdinality.ByOccurrence || sortOrder == ValueToKeyMappingEstimator.KeyOrdinality.ByValue); 51bool sorted = sortOrder == ValueToKeyMappingEstimator.KeyOrdinality.ByValue;
Microsoft.ML.EntryPoints (1)
FeatureCombiner.cs (1)
255Sort = ValueToKeyMappingEstimator.KeyOrdinality.ByValue
Microsoft.ML.Samples (10)
Dynamic\DataOperations\FilterRowsByKeyColumnFraction.cs (1)
36var pipeline = mlContext.Transforms.Conversion.MapValueToKey("Age");
Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (1)
51.ValueToKeyMappingEstimator.KeyOrdinality.ByValue)
Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (2)
55.ValueToKeyMappingEstimator.KeyOrdinality.ByValue) 71.ValueToKeyMappingEstimator.KeyOrdinality.ByValue)
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
50.ValueToKeyMappingEstimator.KeyOrdinality.ByValue)
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (1)
50.ValueToKeyMappingEstimator.KeyOrdinality.ByValue)
Dynamic\Transforms\Conversion\KeyToValueToKey.cs (1)
45ValueToKeyMappingEstimator.KeyOrdinality.ByValue));
Dynamic\Transforms\Conversion\MapValueToKeyMultiColumn.cs (3)
30var pipeline = mlContext.Transforms.Conversion.MapValueToKey(new[] { 34keyOrdinality: Microsoft.ML.Transforms.ValueToKeyMappingEstimator 81var pipelineWithLookupMap = mlContext.Transforms.Conversion
Microsoft.ML.Samples.GPU (5)
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (1)
51.ValueToKeyMappingEstimator.KeyOrdinality.ByValue)
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (2)
55.ValueToKeyMappingEstimator.KeyOrdinality.ByValue) 71.ValueToKeyMappingEstimator.KeyOrdinality.ByValue)
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
50.ValueToKeyMappingEstimator.KeyOrdinality.ByValue)
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (1)
50.ValueToKeyMappingEstimator.KeyOrdinality.ByValue)
Microsoft.ML.Tests (63)
OnnxConversionTest.cs (3)
1185[CombinatorialValues(1, 2)] int maximumNumberOfKeys, ValueToKeyMappingEstimator.KeyOrdinality keyOrdinality, 1208var pipeline = mlContext.Transforms.Conversion.MapValueToKey("Key", "Value", 1776var pipeline1 = mlContext.Transforms.Conversion.MapValueToKey("Label");
TermEstimatorTests.cs (18)
71var pipe = new ValueToKeyMappingEstimator(ML, new[]{ 72new ValueToKeyMappingEstimator.ColumnOptions("TermFloat1", "float1"), 73new ValueToKeyMappingEstimator.ColumnOptions("TermFloat4", "float4"), 74new ValueToKeyMappingEstimator.ColumnOptions("TermDouble1", "double1"), 75new ValueToKeyMappingEstimator.ColumnOptions("TermDouble4", "double4"), 76new ValueToKeyMappingEstimator.ColumnOptions("TermInt1", "int1"), 77new ValueToKeyMappingEstimator.ColumnOptions("TermText1", "text1"), 78new ValueToKeyMappingEstimator.ColumnOptions("TermText2", "text2") 102var pipe = new ValueToKeyMappingEstimator(Env, new[]{ 103new ValueToKeyMappingEstimator.ColumnOptions("TermA", "A"), 104new ValueToKeyMappingEstimator.ColumnOptions("TermB", "B"), 105new ValueToKeyMappingEstimator.ColumnOptions("TermC", "C") 117var est = new ValueToKeyMappingEstimator(Env, new[]{ 118new ValueToKeyMappingEstimator.ColumnOptions("TermA", "A"), 119new ValueToKeyMappingEstimator.ColumnOptions("TermB", "B"), 120new ValueToKeyMappingEstimator.ColumnOptions("TermC", "C") 139var termEst = new ValueToKeyMappingEstimator(Env, new[] { 140new ValueToKeyMappingEstimator.ColumnOptions("T", "Term") });
TrainerEstimators\TrainerEstimators.cs (4)
240var pipeline = new ValueToKeyMappingEstimator(Env, new[]{ 241new ValueToKeyMappingEstimator.ColumnOptions("Group", "Workclass"), 242new ValueToKeyMappingEstimator.ColumnOptions("Label0", "Label") }); 288var pipeline = new ValueToKeyMappingEstimator(Env, "Label");
Transformers\ConvertTests.cs (2)
291var ci = new ValueToKeyMappingEstimator.ColumnOptions("CatA", "A"); 292var pipe = mlContext.Transforms.Conversion.MapValueToKey(new[] { ci }, sideData);
Transformers\KeyToBinaryVectorEstimatorTest.cs (14)
49new ValueToKeyMappingEstimator.ColumnOptions("TermA", "A"), 50new ValueToKeyMappingEstimator.ColumnOptions("TermB", "B"), 51new ValueToKeyMappingEstimator.ColumnOptions("TermC", "C", addKeyValueAnnotationsAsText:true) 69new ValueToKeyMappingEstimator.ColumnOptions("A", "ScalarString"), 70new ValueToKeyMappingEstimator.ColumnOptions("B", "VectorString") }) 92var termEst = new ValueToKeyMappingEstimator(Env, new[] { 93new ValueToKeyMappingEstimator.ColumnOptions("TA", "A", addKeyValueAnnotationsAsText: true), 94new ValueToKeyMappingEstimator.ColumnOptions("TB", "B", addKeyValueAnnotationsAsText: true), 95new ValueToKeyMappingEstimator.ColumnOptions("TC", "C"), 96new ValueToKeyMappingEstimator.ColumnOptions("TD", "D") }); 148var est = new ValueToKeyMappingEstimator(Env, new[]{ 149new ValueToKeyMappingEstimator.ColumnOptions("TermA", "A"), 150new ValueToKeyMappingEstimator.ColumnOptions("TermB", "B", addKeyValueAnnotationsAsText:true), 151new ValueToKeyMappingEstimator.ColumnOptions("TermC", "C")
Transformers\KeyToValueTests.cs (4)
40new ValueToKeyMappingEstimator.ColumnOptions("A", "ScalarString"), 41new ValueToKeyMappingEstimator.ColumnOptions("B", "VectorString") }).Fit(data).Transform(data); 74new ValueToKeyMappingEstimator.ColumnOptions("A", "ScalarString"), 75new ValueToKeyMappingEstimator.ColumnOptions("B", "VectorString") })
Transformers\KeyToVectorEstimatorTests.cs (18)
56new ValueToKeyMappingEstimator.ColumnOptions("TermA", "A"), 57new ValueToKeyMappingEstimator.ColumnOptions("TermB", "B"), 58new ValueToKeyMappingEstimator.ColumnOptions("TermC", "C", addKeyValueAnnotationsAsText:true) 79new ValueToKeyMappingEstimator.ColumnOptions("A", "ScalarString"), 80new ValueToKeyMappingEstimator.ColumnOptions("B", "VectorString") }) 102var termEst = new ValueToKeyMappingEstimator(Env, new[] { 103new ValueToKeyMappingEstimator.ColumnOptions("TA", "A", addKeyValueAnnotationsAsText: true), 104new ValueToKeyMappingEstimator.ColumnOptions("TB", "B"), 105new ValueToKeyMappingEstimator.ColumnOptions("TC", "C", addKeyValueAnnotationsAsText: true), 106new ValueToKeyMappingEstimator.ColumnOptions("TD", "D", addKeyValueAnnotationsAsText: true), 107new ValueToKeyMappingEstimator.ColumnOptions("TE", "E"), 108new ValueToKeyMappingEstimator.ColumnOptions("TF", "F"), 109new ValueToKeyMappingEstimator.ColumnOptions("TG", "G"), 110new ValueToKeyMappingEstimator.ColumnOptions("TH", "H", addKeyValueAnnotationsAsText: true) }); 207var est = new ValueToKeyMappingEstimator(Env, new[]{ 208new ValueToKeyMappingEstimator.ColumnOptions("TermA", "A"), 209new ValueToKeyMappingEstimator.ColumnOptions("TermB", "B"), 210new ValueToKeyMappingEstimator.ColumnOptions("TermC", "C")
Microsoft.ML.TorchSharp.Tests (1)
TextClassificationTests.cs (1)
316var dataPrep = ML.Transforms.Conversion.MapValueToKey("Label");
Microsoft.ML.Transforms (27)
CategoricalCatalog.cs (10)
32/// <param name="keyOrdinality">How items should be ordered when vectorized. If <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByOccurrence"/> 33/// choosen they will be in the order encountered. If <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByValue"/>, 47int maximumNumberOfKeys = ValueToKeyMappingEstimator.Defaults.MaximumNumberOfKeys, 48ValueToKeyMappingEstimator.KeyOrdinality keyOrdinality = ValueToKeyMappingEstimator.Defaults.Ordinality, 66/// <param name="keyOrdinality">How items should be ordered when vectorized. If <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByOccurrence"/> 67/// choosen they will be in the order encountered. If <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByValue"/>, 80int maximumNumberOfKeys = ValueToKeyMappingEstimator.Defaults.MaximumNumberOfKeys, 81ValueToKeyMappingEstimator.KeyOrdinality keyOrdinality = ValueToKeyMappingEstimator.Defaults.Ordinality,
OneHotEncoding.cs (11)
127internal OneHotEncodingTransformer(ValueToKeyMappingEstimator term, IEstimator<ITransformer> toVector, IDataView input) 194/// <seealso cref="CategoricalCatalog.OneHotEncoding(TransformsCatalog.CategoricalTransforms, InputOutputColumnPair[], OneHotEncodingEstimator.OutputKind, int, ValueToKeyMappingEstimator.KeyOrdinality, IDataView)"/> 195/// <seealso cref="CategoricalCatalog.OneHotEncoding(TransformsCatalog.CategoricalTransforms, string, string, OneHotEncodingEstimator.OutputKind, int, ValueToKeyMappingEstimator.KeyOrdinality, IDataView)"/> 235internal sealed class ColumnOptions : ValueToKeyMappingEstimator.ColumnOptionsBase 245/// <param name="keyOrdinality">How items should be ordered when vectorized. If <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByOccurrence"/> choosen they will be in the order encountered. 246/// If <see cref="ValueToKeyMappingEstimator.KeyOrdinality.ByValue"/>, items are sorted according to their default comparison, for example, text sorting will be case sensitive (for example, 'A' then 'Z' then 'a').</param> 249int maximumNumberOfKeys = ValueToKeyMappingEstimator.Defaults.MaximumNumberOfKeys, ValueToKeyMappingEstimator.KeyOrdinality keyOrdinality = ValueToKeyMappingEstimator.Defaults.Ordinality) 265private ValueToKeyMappingEstimator _term; 344_term = (ValueToKeyMappingEstimator)_term.WithOnFitDelegate(onFit);
OneHotHashEncoding.cs (1)
327_host = env.Register(nameof(ValueToKeyMappingEstimator));
Text\WordBagTransform.cs (5)
490var columnOptions = new List<ValueToKeyMappingEstimator.ColumnOptionsBase>(); 496var colOptions = new ValueToKeyMappingEstimator.ColumnOptions( 502keyOrdinality: termLoaderArgs?.Sort ?? ValueToKeyMappingEstimator.KeyOrdinality.ByOccurrence); 605public ValueToKeyMappingEstimator.KeyOrdinality Sort = ValueToKeyMappingEstimator.KeyOrdinality.ByOccurrence;