autora.experiment_runner.synthetic.abstract.template_experiment
A template synthetic experiment.
Examples:
>>> from autora.experiment_runner.synthetic.abstract.template_experiment import (
... template_experiment
... )
We can instantiate the experiment using the imported function
>>> s = template_experiment()
>>> s
SyntheticExperimentCollection(name='Template Experiment', description='...',
params={'name': ...}, ...)
>>> s.name
'Template Experiment'
>>> s.variables
VariableCollection(...)
>>> s.domain()
array([[0],
[1],
[2],
[3]])
>>> s.ground_truth
functools.partial(<function template_experiment.<locals>.run at 0x...>,
added_noise=0.0)
>>> float(s.ground_truth(1.))
2.0
>>> s.ground_truth(s.domain())
array([[1.],
[2.],
[3.],
[4.]])
>>> s.run
<function template_experiment.<locals>.run at 0x...>
>>> float(s.run(1., random_state=42))
2.003047170797544
>>> s.run(s.domain(), random_state=42)
array([[1.00304717],
[1.98960016],
[3.00750451],
[4.00940565]])
>>> s.plotter()
>>> plt.show()
Generate a new version of the experiment with different parameters:
>>> new_params = dict(s.params)
>>> s.factory_function(**new_params)
SyntheticExperimentCollection(...)
template_experiment(name='Template Experiment')
A template for synthetic experiments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
name of the experiment |
'Template Experiment'
|
Source code in autora/experiment_runner/synthetic/abstract/template_experiment.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|