|
10 | 10 | "source": [ |
11 | 11 | "In AutoML.Net, `SearchSpace` defines the hyper-parameter searching range of a sweepable pipeline or a sweepable estimator and `Parameter` is the sampled result from a `SearchSpace`, which can be used to restore an estimator or a pipeline.\n", |
12 | 12 | "\n", |
13 | | - "`SearchSpace` has a great impact on automl performance. In theory, it decides the upper-bound of an automl model. A larger `SearchSpace` usually means an increasing potential of finding a better model. In practice though, there's also a trade-off and a larger `SearchSpace` doesn't always mean better considering the searching complexity and increasing training cost.\n", |
| 13 | + "`SearchSpace` has a great impact on automl performance. In theory, it decides the upper-bound of an automl model. A larger `SearchSpace` usually means an increasing potential of finding a better model. In practice though, there's also a trade-off and a larger `SearchSpace` doesn't always to be better considering the increasing searching complexity and higher training cost.\n", |
14 | 14 | "\n", |
15 | | - "AutoML.Net provides a default `SearchSpace` for almost all available ML.Net trainers. However, it also allows you to provide your own search space if the default one doesn't meet your request.\n", |
| 15 | + "AutoML.Net provides default `SearchSpace` for almost all available ML.Net trainers, which is well-tuned on hundreds of dataset and should be good enough in 99% situation. However, you can also provide your own search space if the default one doesn't meet your request.\n", |
16 | 16 | "\n", |
17 | | - "In this notebook, we will go through a series of topics on search space\n", |
| 17 | + "In this notebook, we will go through the following topics on search space\n", |
18 | 18 | "- default search space for mlnet trainers.\n", |
19 | | - "- how to customize search space" |
| 19 | + "- how to customize search space\n", |
| 20 | + "- how to sample from search space" |
20 | 21 | ] |
21 | 22 | }, |
22 | 23 | { |
23 | 24 | "cell_type": "markdown", |
24 | 25 | "metadata": {}, |
25 | 26 | "source": [ |
26 | | - "# Install nuget dependency" |
| 27 | + "# Install nuget dependency and import using statement" |
27 | 28 | ] |
28 | 29 | }, |
29 | 30 | { |
|
256 | 257 | "using Microsoft.ML.AutoML.CodeGen;\n", |
257 | 258 | "var lgbmSearchSpace = new SearchSpace<LgbmOption>();\n", |
258 | 259 | "\n", |
259 | | - "// refine search space if necessary\n", |
| 260 | + "// the default option for NumberOfLeaves is (4, 32768, logBase: true)\n", |
| 261 | + "// this might be too large but you can refine it if necessary\n", |
260 | 262 | "lgbmSearchSpace[\"NumberOfLeaves\"] = new UniformIntOption(4, 1024, true, 4);\n", |
261 | 263 | "\n", |
262 | 264 | "// pass lgbmSearchSpace in AutoTrainer\n", |
|
409 | 411 | "metadata": {}, |
410 | 412 | "source": [ |
411 | 413 | "# create `SearchSpace<T>` which casts sampled parameter to a concrete type.\n", |
412 | | - "AutoML allows you to use attribution on property to avoid creating search space from scratch. The following code shows how to create an identical search space from above except using attribution API\n", |
| 414 | + "AutoML allows you to define `SearchSpace` with class type, in which case it checks class property and build up search space using those properties with option attributions. The following code shows how to create an identical search space from above using except with a class type.\n", |
413 | 415 | "\n", |
414 | 416 | "`SearchSpace<T>`, comparing with `SearchSpace`, will also cast sampled parameter to a concrete type `T` instead of `Parameter`, which saves the effort of getting specific hyper-parameter value from `Parameter`." |
415 | 417 | ] |
|
553 | 555 | "metadata": {}, |
554 | 556 | "source": [ |
555 | 557 | "# Sampling `Parameter` from `SearchSpace`\n", |
556 | | - "In AutoML.Net, `SearchSpace` is associated with an `n`-dimension vector which is called `feature space`. And tuner, instead of performing sampling on original options in a `SearchSpace`, sampling from that `feature space` instead. And `SearchSpace` will then mapping the sampling result back to its options.\n", |
| 558 | + "In AutoML.Net, `SearchSpace` is associated with an `n`-dimension vector which is called `feature space`. And tuner, instead of performing sampling on original options in a `SearchSpace`, sampling from that `feature space` instead. The sampling result will then mapping back to options.\n", |
557 | 559 | "\n", |
558 | | - "The following code shows the sampling process above, which creates an `n`-d random vector and use that vector to sample from search space. Notice that because the type of created search space is `SearchSpace`, the result sampled from `n`-d vector is `Parameter` rather than a concrete type." |
| 560 | + "The following code shows the sampling process above. It creates an `n`-d random vector and uses that vector to sample from search space." |
559 | 561 | ] |
560 | 562 | }, |
561 | 563 | { |
|
593 | 595 | " var featureVector = Enumerable.Range(0, dim).Select(x => rnd.NextDouble()).ToArray();\n", |
594 | 596 | " var parameter = searchSpace.SampleFromFeatureSpace(featureVector);\n", |
595 | 597 | "\n", |
596 | | - " // use Parameter.AsType to map parameter to a concrete type.\n", |
| 598 | + " // use Parameter.AsType<T> to map parameter to a concrete type.\n", |
597 | 599 | " var myParameter = parameter.AsType<MyParameter>();\n", |
598 | 600 | " var json = JsonConvert.SerializeObject(myParameter);\n", |
599 | 601 | "\n", |
|
0 commit comments