|
4 | 4 |
|
5 | 5 | using Microsoft.ML.Runtime;
|
6 | 6 | using Microsoft.ML.Runtime.Data;
|
| 7 | +using Microsoft.ML.Transforms; |
7 | 8 | using Microsoft.ML.Transforms.Conversions;
|
| 9 | +using System.Collections.Generic; |
8 | 10 |
|
9 | 11 | namespace Microsoft.ML
|
10 | 12 | {
|
@@ -125,5 +127,23 @@ public static ValueToKeyMappingEstimator MapValueToKey(this TransformsCatalog.Co
|
125 | 127 | string termsColumn = null,
|
126 | 128 | IComponentFactory<IMultiStreamSource, IDataLoader> loaderFactory = null)
|
127 | 129 | => new ValueToKeyMappingEstimator(CatalogUtils.GetEnvironment(catalog), columns, file, termsColumn, loaderFactory);
|
| 130 | + |
| 131 | + /// <summary> |
| 132 | + /// Maps specified keys to specified values |
| 133 | + /// </summary> |
| 134 | + /// <typeparam name="TInputType">The key type.</typeparam> |
| 135 | + /// <typeparam name="TOutputType">The value type.</typeparam> |
| 136 | + /// <param name="catalog">The categorical transform's catalog</param> |
| 137 | + /// <param name="keys">The list of keys to use for the mapping. The mapping is 1-1 with values. This list must be the same length as values and |
| 138 | + /// cannot contain duplicate keys.</param> |
| 139 | + /// <param name="values">The list of values to pair with the keys for the mapping. This list must be equal to the same length as keys.</param> |
| 140 | + /// <param name="columns">The columns to apply this transform on.</param> |
| 141 | + /// <returns></returns> |
| 142 | + public static ValueMappingEstimator<TInputType, TOutputType> ValueMap<TInputType, TOutputType>( |
| 143 | + this TransformsCatalog.ConversionTransforms catalog, |
| 144 | + IEnumerable<TInputType> keys, |
| 145 | + IEnumerable<TOutputType> values, |
| 146 | + params (string source, string name)[] columns) |
| 147 | + => new ValueMappingEstimator<TInputType, TOutputType>(CatalogUtils.GetEnvironment(catalog), keys, values, columns); |
128 | 148 | }
|
129 | 149 | }
|
0 commit comments