Skip to content

Commit

Permalink
Add source generator to generate search space class for all trainers/…
Browse files Browse the repository at this point in the history
…transformers (#6090)

* add source generator

* add Search Space Json

* fix comments

* migrate to system.text.json

* use culture invariant

* pack search space in automl

* fix comments

* eof
  • Loading branch information
LittleLittleCloud committed Mar 2, 2022
1 parent ea8ced0 commit 3055403
Show file tree
Hide file tree
Showing 41 changed files with 1,514 additions and 13 deletions.
11 changes: 11 additions & 0 deletions Microsoft.ML.sln
Expand Up @@ -153,6 +153,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.SearchSpace",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.SearchSpace.Tests", "test\Microsoft.ML.SearchSpace.Tests\Microsoft.ML.SearchSpace.Tests.csproj", "{A3E9F25F-2718-4FF9-A35A-54C232A847AB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.ML.AutoML.SourceGenerator", "tools-local\Microsoft.ML.AutoML.SourceGenerator\Microsoft.ML.AutoML.SourceGenerator.csproj", "{C804B990-390E-41D7-8FF1-6774495D70E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -717,6 +719,14 @@ Global
{A3E9F25F-2718-4FF9-A35A-54C232A847AB}.Release|Any CPU.Build.0 = Release|Any CPU
{A3E9F25F-2718-4FF9-A35A-54C232A847AB}.Release|x64.ActiveCfg = Release|Any CPU
{A3E9F25F-2718-4FF9-A35A-54C232A847AB}.Release|x64.Build.0 = Release|Any CPU
{C804B990-390E-41D7-8FF1-6774495D70E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C804B990-390E-41D7-8FF1-6774495D70E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C804B990-390E-41D7-8FF1-6774495D70E2}.Debug|x64.ActiveCfg = Debug|Any CPU
{C804B990-390E-41D7-8FF1-6774495D70E2}.Debug|x64.Build.0 = Debug|Any CPU
{C804B990-390E-41D7-8FF1-6774495D70E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C804B990-390E-41D7-8FF1-6774495D70E2}.Release|Any CPU.Build.0 = Release|Any CPU
{C804B990-390E-41D7-8FF1-6774495D70E2}.Release|x64.ActiveCfg = Release|Any CPU
{C804B990-390E-41D7-8FF1-6774495D70E2}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -792,6 +802,7 @@ Global
{8AFB8CC3-DA0B-4364-BFB3-296A7C54CC25} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
{A8F4F08F-1F9D-4AAE-8C8D-502CDBBDE7D3} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
{A3E9F25F-2718-4FF9-A35A-54C232A847AB} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
{C804B990-390E-41D7-8FF1-6774495D70E2} = {7F13E156-3EBA-4021-84A5-CD56BA72F99E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {41165AF1-35BB-4832-A189-73060F82B01D}
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.ML.AutoML/API/ExperimentSettings.cs
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.IO;
using System.Threading;

namespace Microsoft.ML.AutoML
Expand Down
27 changes: 27 additions & 0 deletions src/Microsoft.ML.AutoML/CodeGen/apply_onnx_search_space.json
@@ -0,0 +1,27 @@
{
"$schema": "./search-space-schema.json#",
"name": "apply_onnx_model_option",
"search_space": [
{
"name": "ModelFile",
"type": "string"
},
{
"name": "GpuDeviceId",
"type": "integer"
},
{
"name": "FallbackToCpu",
"type": "boolean",
"default": false
},
{
"name": "OutputColumnName",
"type": "string"
},
{
"name": "InputColumnName",
"type": "string"
}
]
}
7 changes: 7 additions & 0 deletions src/Microsoft.ML.AutoML/CodeGen/code_gen_flag.json
@@ -0,0 +1,7 @@
{
"EstimatorFactoryGenerator": false,
"CodeGenCatalogGenerator": false,
"EstimatorTypeGenerator": false,
"SearchSpaceGenerator": true,
"SweepableEstimatorGenerator": false
}
14 changes: 14 additions & 0 deletions src/Microsoft.ML.AutoML/CodeGen/concat_search_space.json
@@ -0,0 +1,14 @@
{
"$schema": "./search-space-schema.json#",
"name": "concat_option",
"search_space": [
{
"name": "InputColumnNames",
"type": "strings"
},
{
"name": "OutputColumnName",
"type": "string"
}
]
}
30 changes: 30 additions & 0 deletions src/Microsoft.ML.AutoML/CodeGen/extra_pixels_search_space.json
@@ -0,0 +1,30 @@
{
"$schema": "./search-space-schema.json#",
"name": "extract_pixels_option",
"search_space": [
{
"name": "OutputColumnName",
"type": "string",
"default": "Output"
},
{
"name": "InputColumnName",
"type": "string"
},
{
"name": "ColorsToExtract",
"type": "colorBits",
"default": "ColorBits.Rgb"
},
{
"name": "OrderOfExtraction",
"type": "colorsOrder",
"default": "ColorsOrder.ARGB"
},
{
"name": "OutputAsFloatArray",
"type": "boolean",
"default": true
}
]
}
50 changes: 50 additions & 0 deletions src/Microsoft.ML.AutoML/CodeGen/fast_forest_search_space.json
@@ -0,0 +1,50 @@
{
"$schema": "./search-space-schema.json#",
"name": "fast_forest_option",
"search_space": [
{
"name": "NumberOfTrees",
"type": "integer",
"default": 4,
"search_space": {
"min": 4,
"max": 32768,
"log_base": true
}
},
{
"name": "NumberOfLeaves",
"type": "integer",
"default": 4,
"search_space": {
"min": 4,
"max": 32768,
"log_base": true
}
},
{
"name": "FeatureFraction",
"type": "float",
"default": 1,
"search_space": {
"min": 2e-10,
"max": 1,
"log_base": false
}
},
{
"name": "LabelColumnName",
"type": "string",
"default": "Label"
},
{
"name": "FeatureColumnName",
"type": "string",
"default": "Feature"
},
{
"name": "ExampleWeightColumnName",
"type": "string"
}
]
}
80 changes: 80 additions & 0 deletions src/Microsoft.ML.AutoML/CodeGen/fast_tree_search_space.json
@@ -0,0 +1,80 @@
{
"$schema": "./search-space-schema.json#",
"name": "fast_tree_option",
"search_space": [
{
"name": "NumberOfLeaves",
"type": "integer",
"default": 4,
"search_space": {
"log_base": true,
"min": 4,
"max": 32768
}
},
{
"name": "MinimumExampleCountPerLeaf",
"type": "integer",
"default": 20,
"search_space": {
"log_base": true,
"min": 2,
"max": 128
}
},
{
"name": "NumberOfTrees",
"type": "integer",
"default": 4,
"search_space": {
"min": 4,
"max": 32768,
"log_base": true
}
},
{
"name": "MaximumBinCountPerFeature",
"type": "integer",
"default": 256,
"search_space": {
"min": 8,
"max": 1024,
"log_base": true
}
},
{
"name": "FeatureFraction",
"type": "double",
"default": 1,
"search_space": {
"min": 2e-10,
"max": 1,
"log_base": false
}
},
{
"name": "LearningRate",
"type": "double",
"default": 0.1,
"search_space": {
"min": 2e-10,
"max": 1,
"log_base": true
}
},
{
"name": "LabelColumnName",
"type": "string",
"default": "Label"
},
{
"name": "FeatureColumnName",
"type": "string",
"default": "Feature"
},
{
"name": "ExampleWeightColumnName",
"type": "string"
}
]
}
14 changes: 14 additions & 0 deletions src/Microsoft.ML.AutoML/CodeGen/featurize_text_search_space.json
@@ -0,0 +1,14 @@
{
"$schema": "./search-space-schema.json#",
"name": "featurize_text_option",
"search_space": [
{
"name": "InputColumnName",
"type": "string"
},
{
"name": "OutputColumnName",
"type": "string"
}
]
}
@@ -0,0 +1,21 @@
{
"$schema": "./search-space-schema.json#",
"name": "image_classification_option",
"search_space": [
{
"name": "LabelColumnName",
"type": "string",
"default": "Label"
},
{
"name": "ScoreColumnName",
"type": "string",
"default": "Score"
},
{
"name": "FeatureColumnName",
"type": "string",
"default": "Feature"
}
]
}
40 changes: 40 additions & 0 deletions src/Microsoft.ML.AutoML/CodeGen/lbfgs_search_space.json
@@ -0,0 +1,40 @@
{
"$schema": "./search-space-schema.json#",
"name": "lbfgs_option",
"search_space": [
{
"name": "L1Regularization",
"type": "float",
"default": 1,
"search_space": {
"min": 0.03125,
"max": 32768,
"log_base": true
}
},
{
"name": "L2Regularization",
"type": "float",
"default": 1,
"search_space": {
"min": 0.03125,
"max": 32768,
"log_base": true
}
},
{
"name": "LabelColumnName",
"type": "string",
"default": "Label"
},
{
"name": "FeatureColumnName",
"type": "string",
"default": "Feature"
},
{
"name": "ExampleWeightColumnName",
"type": "string"
}
]
}

0 comments on commit 3055403

Please sign in to comment.