Skip to content

Commit 4d69110

Browse files
Add new type to key-value converter (#6973)
* Add new type to key-value * Make it IDataView * clean * add dataview support in source generator * Update type_converter_search_space.json * Update search-space-schema.json --------- Co-authored-by: XiaoYun Zhang <[email protected]> Co-authored-by: Xiaoyun Zhang <[email protected]>
1 parent 4c44e92 commit 4d69110

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

src/Microsoft.ML.AutoML/CodeGen/map_value_to_key_search_space.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"name": "AddKeyValueAnnotationsAsText",
1515
"type": "boolean",
1616
"default": false
17+
},
18+
{
19+
"name": "KeyData",
20+
"type": "dataView"
1721
}
1822
]
1923
}

src/Microsoft.ML.AutoML/CodeGen/search-space-schema.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@
240240
"predictedAnswerColumnName",
241241
"TopKAnswers",
242242
"TargetType",
243-
"PredictionColumnName"
243+
"PredictionColumnName",
244+
"KeyData"
244245
]
245246
},
246247
"option_type": {
@@ -259,7 +260,8 @@
259260
"dnnModelFactory",
260261
"bertArchitecture",
261262
"imageClassificationArchType",
262-
"dataKind"
263+
"dataKind",
264+
"dataView"
263265
]
264266
}
265267
},

src/Microsoft.ML.AutoML/CodeGen/type_converter_search_space.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"name": "TargetType",
1515
"type": "dataKind",
1616
"default": "DataKind.Single"
17+
},
18+
{
19+
"name": "KeyData",
20+
"type": "dataView"
1721
}
1822
]
1923
}

src/Microsoft.ML.AutoML/SweepableEstimator/Estimators/MapValueToKey.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ internal partial class MapValueToKey
88
{
99
public override IEstimator<ITransformer> BuildFromOption(MLContext context, MapValueToKeyOption param)
1010
{
11-
return context.Transforms.Conversion.MapValueToKey(param.OutputColumnName, param.InputColumnName, addKeyValueAnnotationsAsText: param.AddKeyValueAnnotationsAsText);
11+
return context.Transforms.Conversion.MapValueToKey(param.OutputColumnName, param.InputColumnName, addKeyValueAnnotationsAsText: param.AddKeyValueAnnotationsAsText, keyData: param.KeyData);
1212
}
1313
}
1414

tools-local/Microsoft.ML.AutoML.SourceGenerator/SearchSpaceGenerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public void Execute(GeneratorExecutionContext context)
5757
"bertArchitecture" => "BertArchitecture",
5858
"imageClassificationArchType" => "Microsoft.ML.Vision.ImageClassificationTrainer.Architecture",
5959
"dataKind" => "Microsoft.ML.Data.DataKind",
60+
"dataView" => "Microsoft.ML.IDataView",
6061
_ => throw new ArgumentException("unknown type"),
6162
};
6263

@@ -76,6 +77,7 @@ public void Execute(GeneratorExecutionContext context)
7677
(_, "BertArchitecture") => defaultToken.GetValue<string>(),
7778
(_, "Microsoft.ML.Vision.ImageClassificationTrainer.Architecture") => defaultToken.GetValue<string>(),
7879
(_, "Microsoft.ML.Data.DataKind") => defaultToken.GetValue<string>(),
80+
(_, "Microsoft.ML.IDataView") => defaultToken.GetValue<string>(),
7981
(_, _) => throw new ArgumentException("unknown"),
8082
};
8183

0 commit comments

Comments
 (0)