|
11 | 11 | "\n", |
12 | 12 | "The :class:`~optimas.diagnostics.ExplorationDiagnostics` class\n", |
13 | 13 | "provides a simple way of fitting a Gaussian process (GP) model to any of the\n", |
14 | | - "objectives or analyzed parameters of an ``optimas``\n", |
| 14 | + "objectives or observables of an ``optimas``\n", |
15 | 15 | ":class:`~optimas.explorations.Exploration`, independently of which generator\n", |
16 | 16 | "was used. This is useful to get a better understanding of the underlying\n", |
17 | 17 | "function, make predictions, etc.\n", |
|
29 | 29 | "\n", |
30 | 30 | "The following cell sets up and runs an optimization with two input parameters\n", |
31 | 31 | "``x1`` and ``x2``, two objectives ``f1`` and ``f2``, and one additional\n", |
32 | | - "analyzed parameter ``p1``.\n", |
| 32 | + "observable ``p1``.\n", |
33 | 33 | "At each evaluation, the ``eval_func_sf_moo`` function is run,\n", |
34 | 34 | "which assigns a value to each outcome parameter according to the analytical\n", |
35 | 35 | "formulas\n", |
|
55 | 55 | "source": [ |
56 | 56 | "import numpy as np\n", |
57 | 57 | "from optimas.explorations import Exploration\n", |
58 | | - "from optimas.core import VaryingParameter, Objective, Parameter\n", |
59 | 58 | "from optimas.generators import RandomSamplingGenerator\n", |
60 | 59 | "from optimas.evaluators import FunctionEvaluator\n", |
| 60 | + "from gest_api.vocs import VOCS\n", |
61 | 61 | "\n", |
62 | 62 | "\n", |
63 | 63 | "def eval_func_sf_moo(input_params, output_params):\n", |
|
70 | 70 | " output_params[\"p1\"] = np.sin(x1) + np.cos(x2)\n", |
71 | 71 | "\n", |
72 | 72 | "\n", |
73 | | - "var1 = VaryingParameter(\"x1\", 0.0, 5.0)\n", |
74 | | - "var2 = VaryingParameter(\"x2\", -5.0, 5.0)\n", |
75 | | - "par1 = Parameter(\"p1\")\n", |
76 | | - "obj1 = Objective(\"f1\", minimize=True)\n", |
77 | | - "obj2 = Objective(\"f2\", minimize=False)\n", |
78 | | - "\n", |
79 | | - "gen = RandomSamplingGenerator(\n", |
80 | | - " varying_parameters=[var1, var2],\n", |
81 | | - " objectives=[obj1, obj2],\n", |
82 | | - " analyzed_parameters=[par1],\n", |
| 73 | + "# Create VOCS object defining variables, objectives, and observables.\n", |
| 74 | + "vocs = VOCS(\n", |
| 75 | + " variables={\n", |
| 76 | + " \"x1\": [0.0, 5.0],\n", |
| 77 | + " \"x2\": [-5.0, 5.0],\n", |
| 78 | + " },\n", |
| 79 | + " objectives={\n", |
| 80 | + " \"f1\": \"MINIMIZE\",\n", |
| 81 | + " \"f2\": \"MAXIMIZE\",\n", |
| 82 | + " },\n", |
| 83 | + " observables=[\"p1\"],\n", |
83 | 84 | ")\n", |
| 85 | + "\n", |
| 86 | + "gen = RandomSamplingGenerator(vocs=vocs)\n", |
84 | 87 | "ev = FunctionEvaluator(function=eval_func_sf_moo)\n", |
85 | 88 | "exploration = Exploration(\n", |
86 | 89 | " generator=gen,\n", |
|
125 | 128 | "raw_mimetype": "text/restructuredtext" |
126 | 129 | }, |
127 | 130 | "source": [ |
128 | | - "Building a GP model of each objective and analyzed parameter\n", |
129 | | - "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n", |
| 131 | + "Building a GP model of each objective and observable\n", |
| 132 | + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n", |
130 | 133 | "\n", |
131 | 134 | "To build a GP model, simply call\n", |
132 | 135 | ":meth:`~optimas.diagnostics.Exploration.build_gp_model` on the diagnostics,\n", |
133 | 136 | "indicating the name of the variable to which the model should be fitted.\n", |
134 | | - "This variable can be any ``objective`` or ``analyzed_parameter`` of the\n", |
| 137 | + "This variable can be any ``objective`` or ``observable`` of the\n", |
135 | 138 | "optimization.\n", |
136 | 139 | "\n", |
137 | | - "Note that when building a surrogate model of an analyzed parameter, it is\n", |
| 140 | + "Note that when building a surrogate model of an observable, it is\n", |
138 | 141 | "required to provide a value to the ``minimize`` argument. This parameter\n", |
139 | | - "should therefore be ``True`` if lower values of the analyzed parameter are\n", |
| 142 | + "should therefore be ``True`` if lower values of the observable are\n", |
140 | 143 | "better than higher values. This information is necessary, e.g., for determining\n", |
141 | 144 | "the best point in the model." |
142 | 145 | ] |
|
147 | 150 | "metadata": {}, |
148 | 151 | "outputs": [], |
149 | 152 | "source": [ |
150 | | - "# Build one model for each objective and analyzed parameter.\n", |
| 153 | + "# Build one model for each objective and observable.\n", |
151 | 154 | "f1_model = diags.build_gp_model(\"f1\")\n", |
152 | 155 | "f2_model = diags.build_gp_model(\"f2\")\n", |
153 | 156 | "p1_model = diags.build_gp_model(\"p1\", minimize=False)" |
|
0 commit comments