diff --git a/docs/source/al_description.rst b/docs/source/al_description.rst index c1d5e99f2ec65aeaf8f0933096bd351ca0c6e465..7922be0f86155e5fc39211672c03120fa1552cf9 100644 --- a/docs/source/al_description.rst +++ b/docs/source/al_description.rst @@ -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 diff --git a/examples/user_guide/example_user_guide.py b/examples/user_guide/example_user_guide.py index 563850ddcc1806ac0e3f3e3b23ee4a067a0b428a..0a1f5ed064de30e6baaf9d20a31d4c3b28ebc5b3 100644 --- a/examples/user_guide/example_user_guide.py +++ b/examples/user_guide/example_user_guide.py @@ -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_)