|
197 | 197 | "source": [ |
198 | 198 | "spot_exact_mm.plot_important_hyperparameter_contour(max_imp=3)" |
199 | 199 | ] |
| 200 | + }, |
| 201 | + { |
| 202 | + "cell_type": "code", |
| 203 | + "execution_count": 1, |
| 204 | + "metadata": {}, |
| 205 | + "outputs": [ |
| 206 | + { |
| 207 | + "name": "stderr", |
| 208 | + "output_type": "stream", |
| 209 | + "text": [ |
| 210 | + "Seed set to 123\n", |
| 211 | + "Seed set to 123\n" |
| 212 | + ] |
| 213 | + }, |
| 214 | + { |
| 215 | + "name": "stdout", |
| 216 | + "output_type": "stream", |
| 217 | + "text": [ |
| 218 | + "S.X: [[ 0.86352963 0.7892358 ]\n", |
| 219 | + " [-0.24407197 -0.83687436]\n", |
| 220 | + " [ 0.36481882 0.8375811 ]\n", |
| 221 | + " [ 0.415331 0.54468512]\n", |
| 222 | + " [-0.56395091 -0.77797854]\n", |
| 223 | + " [-0.90259409 -0.04899292]\n", |
| 224 | + " [-0.16484832 0.35724741]\n", |
| 225 | + " [ 0.05170659 0.07401196]\n", |
| 226 | + " [-0.78548145 -0.44638164]\n", |
| 227 | + " [ 0.64017497 -0.30363301]]\n", |
| 228 | + "S.y: [1.36857656 0.75992983 0.83463487 0.46918172 0.92329124 0.8170764\n", |
| 229 | + " 0.15480068 0.00815134 0.81623768 0.502017 ]\n", |
| 230 | + "y_infill: [0.50052583]\n" |
| 231 | + ] |
| 232 | + } |
| 233 | + ], |
| 234 | + "source": [ |
| 235 | + "import numpy as np\n", |
| 236 | + "from spotpython.spot import Spot\n", |
| 237 | + "from spotpython.fun import Analytical\n", |
| 238 | + "from spotpython.utils.init import fun_control_init\n", |
| 239 | + "nn = 3\n", |
| 240 | + "fun_sphere = Analytical().fun_sphere\n", |
| 241 | + "fun_control = fun_control_init(\n", |
| 242 | + " lower = np.array([-1, -1]),\n", |
| 243 | + " upper = np.array([1, 1]),\n", |
| 244 | + " n_points=nn,\n", |
| 245 | + " )\n", |
| 246 | + "S = Spot(\n", |
| 247 | + " fun=fun_sphere,\n", |
| 248 | + " fun_control=fun_control,\n", |
| 249 | + " )\n", |
| 250 | + "S.X = S.design.scipy_lhd(\n", |
| 251 | + " S.design_control[\"init_size\"], lower=S.lower, upper=S.upper\n", |
| 252 | + ")\n", |
| 253 | + "print(f\"S.X: {S.X}\")\n", |
| 254 | + "S.y = S.fun(S.X)\n", |
| 255 | + "print(f\"S.y: {S.y}\")\n", |
| 256 | + "S.fit_surrogate()\n", |
| 257 | + "x = np.array([0.5, 0.5])\n", |
| 258 | + "y_infill = S.infill(x)\n", |
| 259 | + "print(f\"y_infill: {y_infill}\")\n", |
| 260 | + "assert np.isscalar(y_infill) or y_infill.shape == (1,)" |
| 261 | + ] |
| 262 | + }, |
| 263 | + { |
| 264 | + "cell_type": "code", |
| 265 | + "execution_count": 6, |
| 266 | + "metadata": {}, |
| 267 | + "outputs": [ |
| 268 | + { |
| 269 | + "name": "stderr", |
| 270 | + "output_type": "stream", |
| 271 | + "text": [ |
| 272 | + "Seed set to 123\n" |
| 273 | + ] |
| 274 | + }, |
| 275 | + { |
| 276 | + "data": { |
| 277 | + "text/plain": [ |
| 278 | + "[np.float64(3.0), np.int64(2), np.int64(3), np.float64(6.0)]" |
| 279 | + ] |
| 280 | + }, |
| 281 | + "execution_count": 6, |
| 282 | + "metadata": {}, |
| 283 | + "output_type": "execute_result" |
| 284 | + } |
| 285 | + ], |
| 286 | + "source": [ |
| 287 | + "import numpy as np\n", |
| 288 | + "from spotpython.spot import Spot\n", |
| 289 | + "from spotpython.fun import Analytical\n", |
| 290 | + "from spotpython.utils.init import fun_control_init\n", |
| 291 | + "nn = 3\n", |
| 292 | + "fun_sphere = Analytical().fun_sphere\n", |
| 293 | + "fun_control = fun_control_init(\n", |
| 294 | + " lower = np.array([-1, -1]),\n", |
| 295 | + " upper = np.array([1, 1]),\n", |
| 296 | + " n_points=nn,\n", |
| 297 | + " )\n", |
| 298 | + "S = Spot(\n", |
| 299 | + " fun=fun_sphere,\n", |
| 300 | + " fun_control=fun_control,\n", |
| 301 | + " )\n", |
| 302 | + "z00 = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])\n", |
| 303 | + "S.var_type = [\"float\", \"int\", \"int\", \"float\"]\n", |
| 304 | + "S.process_z00(z00)" |
| 305 | + ] |
| 306 | + }, |
| 307 | + { |
| 308 | + "cell_type": "code", |
| 309 | + "execution_count": null, |
| 310 | + "metadata": {}, |
| 311 | + "outputs": [], |
| 312 | + "source": [] |
200 | 313 | } |
201 | 314 | ], |
202 | 315 | "metadata": { |
|
0 commit comments