Skip to content
Snippets Groups Projects
Commit c9a0665d authored by kohlhaasrebecca's avatar kohlhaasrebecca
Browse files

User guide for active learning

parent 7b2e49c5
No related branches found
No related tags found
2 merge requests!29Preparation for release 1.1.0: fixes and test for pages,!27Create sphinx-based website
......@@ -25,3 +25,37 @@ The tradeoff between exploration and exploitation is defined by **tradeoff-schem
Example
=======
We take the engine from :any:`surrogate_description` and change the settings to perform sequential training.
This mainly changes the ``Engine``.
We set the ``method`` to ``'sequential'`` to indicate that active learning should be performed.
For this example we start with the 10 initial samples from :any:`surrogate_description` and increase this iteratively to the number of samples given in ``n_max_samples``.
The parameter ``n_new_samples`` sets the number of new samples that are chosen in each iteration, while ``mod_LOO_threshold`` sets an additional stopping condition.
>>> ExpDesign.method = 'sequential'
>>> ExpDesign.n_max_samples = 14
>>> ExpDesign.n_new_samples = 1
>>> ExpDesign.mod_LOO_threshold = 1e-16
Here we do not set a ``tradeoff_scheme``.
This will result in all samples being chosen based on the exploration weights.
>>> ExpDesign.tradeoff_scheme = None
As the proposed samples come from the exploration method, we still need to define this.
>>> ExpDesign.explore_method = 'random'
>>> ExpDesign.n_canddidate = 1000
>>> ExpDesign.n_cand_groups = 4
For the exploitation method we use a variance-based method, as no data is given.
>>> ExpDesign.exploit_method = 'VarOptDesign'
>>> ExpDesign.util_func = 'EIGF'
Once all properties are set, we can assemble the engine and start it.
This time we use ``train_sequential``.
>>> Engine_ = Engine(MetaMod, Model, ExpDesign)
>>> Engine_.start_engine()
>>> Engine_.train_sequential()
\ No newline at end of file
......@@ -77,6 +77,22 @@ if __name__ == '__main__':
mean, stdev = Engine_.eval_metamodel(nsamples = 10)
mean, stdev = Engine_.MetaModel.eval_metamodel(samples)
#### Active learning
ExpDesign.method = 'sequential'
# Set the sampling parameters
ExpDesign.n_new_samples = 1
ExpDesign.n_max_samples = 14
ExpDesign.mod_LOO_threshold = 1e-16
ExpDesign.tradeoff_scheme = None
ExpDesign.explore_method = 'random'
ExpDesign.n_canddidate = 1000
ExpDesign.n_cand_groups = 4
ExpDesign.exploit_method = 'VarOptDesign'
ExpDesign.util_func = 'EIGF'
Engine_ = Engine(MetaMod, Model, ExpDesign)
Engine_.start_engine()
Engine_.train_sequential()
#### Postprocessing
PostProc = PostProcessing(Engine_)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment