Skip to content

Commit

Permalink
Add new type to key-value converter (#6973)
Browse files Browse the repository at this point in the history
* 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 <xiaoyuz@microsoft.com>
Co-authored-by: Xiaoyun Zhang <bigmiao.zhang@gmail.com>
  • Loading branch information
3 people committed Jan 26, 2024
1 parent 4c44e92 commit 4d69110
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"name": "AddKeyValueAnnotationsAsText",
"type": "boolean",
"default": false
},
{
"name": "KeyData",
"type": "dataView"
}
]
}
6 changes: 4 additions & 2 deletions src/Microsoft.ML.AutoML/CodeGen/search-space-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@
"predictedAnswerColumnName",
"TopKAnswers",
"TargetType",
"PredictionColumnName"
"PredictionColumnName",
"KeyData"
]
},
"option_type": {
Expand All @@ -259,7 +260,8 @@
"dnnModelFactory",
"bertArchitecture",
"imageClassificationArchType",
"dataKind"
"dataKind",
"dataView"
]
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"name": "TargetType",
"type": "dataKind",
"default": "DataKind.Single"
},
{
"name": "KeyData",
"type": "dataView"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ internal partial class MapValueToKey
{
public override IEstimator<ITransformer> BuildFromOption(MLContext context, MapValueToKeyOption param)
{
return context.Transforms.Conversion.MapValueToKey(param.OutputColumnName, param.InputColumnName, addKeyValueAnnotationsAsText: param.AddKeyValueAnnotationsAsText);
return context.Transforms.Conversion.MapValueToKey(param.OutputColumnName, param.InputColumnName, addKeyValueAnnotationsAsText: param.AddKeyValueAnnotationsAsText, keyData: param.KeyData);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void Execute(GeneratorExecutionContext context)
"bertArchitecture" => "BertArchitecture",
"imageClassificationArchType" => "Microsoft.ML.Vision.ImageClassificationTrainer.Architecture",
"dataKind" => "Microsoft.ML.Data.DataKind",
"dataView" => "Microsoft.ML.IDataView",
_ => throw new ArgumentException("unknown type"),
};
Expand All @@ -76,6 +77,7 @@ public void Execute(GeneratorExecutionContext context)
(_, "BertArchitecture") => defaultToken.GetValue<string>(),
(_, "Microsoft.ML.Vision.ImageClassificationTrainer.Architecture") => defaultToken.GetValue<string>(),
(_, "Microsoft.ML.Data.DataKind") => defaultToken.GetValue<string>(),
(_, "Microsoft.ML.IDataView") => defaultToken.GetValue<string>(),
(_, _) => throw new ArgumentException("unknown"),
};
Expand Down

0 comments on commit 4d69110

Please sign in to comment.