|
4288 | 4288 | }, |
4289 | 4289 | { |
4290 | 4290 | "cell_type": "code", |
4291 | | - "execution_count": 12, |
| 4291 | + "execution_count": null, |
4292 | 4292 | "metadata": {}, |
4293 | 4293 | "outputs": [], |
4294 | 4294 | "source": [ |
|
4339 | 4339 | }, |
4340 | 4340 | { |
4341 | 4341 | "cell_type": "code", |
4342 | | - "execution_count": 13, |
| 4342 | + "execution_count": null, |
4343 | 4343 | "metadata": {}, |
4344 | | - "outputs": [ |
4345 | | - { |
4346 | | - "name": "stdout", |
4347 | | - "output_type": "stream", |
4348 | | - "text": [ |
4349 | | - "Model Name: HoeffdingTreeRegressor, Model Instance: <class 'river.tree.hoeffding_tree_regressor.HoeffdingTreeRegressor'>\n" |
4350 | | - ] |
4351 | | - } |
4352 | | - ], |
| 4344 | + "outputs": [], |
4353 | 4345 | "source": [ |
4354 | 4346 | "\n", |
4355 | 4347 | "# Example of usage\n", |
|
4359 | 4351 | }, |
4360 | 4352 | { |
4361 | 4353 | "cell_type": "code", |
4362 | | - "execution_count": 14, |
| 4354 | + "execution_count": null, |
4363 | 4355 | "metadata": {}, |
4364 | | - "outputs": [ |
4365 | | - { |
4366 | | - "name": "stdout", |
4367 | | - "output_type": "stream", |
4368 | | - "text": [ |
4369 | | - "module_name: light\n", |
4370 | | - "submodule_name: regression\n", |
4371 | | - "model_name: NNLinearRegressor\n", |
4372 | | - "Model Name: NNLinearRegressor, Model Instance: <class 'spotPython.light.regression.nn_linear_regressor.NNLinearRegressor'>\n" |
4373 | | - ] |
4374 | | - } |
4375 | | - ], |
| 4356 | + "outputs": [], |
4376 | 4357 | "source": [ |
4377 | 4358 | "model_name, model_instance = get_core_model_from_name(\"light.regression.NNLinearRegressor\")\n", |
4378 | 4359 | "print(f\"Model Name: {model_name}, Model Instance: {model_instance}\")" |
4379 | 4360 | ] |
4380 | 4361 | }, |
4381 | 4362 | { |
4382 | 4363 | "cell_type": "code", |
4383 | | - "execution_count": 15, |
| 4364 | + "execution_count": null, |
4384 | 4365 | "metadata": {}, |
4385 | | - "outputs": [ |
4386 | | - { |
4387 | | - "name": "stderr", |
4388 | | - "output_type": "stream", |
4389 | | - "text": [ |
4390 | | - "/Users/bartz/miniforge3/envs/spotCondaEnv/lib/python3.11/site-packages/lightning/pytorch/utilities/parsing.py:198: Attribute 'act_fn' is an instance of `nn.Module` and is already saved during checkpointing. It is recommended to ignore them using `self.save_hyperparameters(ignore=['act_fn'])`.\n", |
4391 | | - "GPU available: True (mps), used: True\n", |
4392 | | - "TPU available: False, using: 0 TPU cores\n", |
4393 | | - "IPU available: False, using: 0 IPUs\n" |
4394 | | - ] |
4395 | | - }, |
4396 | | - { |
4397 | | - "name": "stderr", |
4398 | | - "output_type": "stream", |
4399 | | - "text": [ |
4400 | | - "HPU available: False, using: 0 HPUs\n", |
4401 | | - "/Users/bartz/miniforge3/envs/spotCondaEnv/lib/python3.11/site-packages/lightning/pytorch/trainer/configuration_validator.py:74: You defined a `validation_step` but have no `val_dataloader`. Skipping val loop.\n", |
4402 | | - "\n", |
4403 | | - " | Name | Type | Params | In sizes | Out sizes\n", |
4404 | | - "-------------------------------------------------------------\n", |
4405 | | - "0 | layers | Sequential | 15.9 K | [8, 10] | [8, 1] \n", |
4406 | | - "-------------------------------------------------------------\n", |
4407 | | - "15.9 K Trainable params\n", |
4408 | | - "0 Non-trainable params\n", |
4409 | | - "15.9 K Total params\n", |
4410 | | - "0.064 Total estimated model params size (MB)\n" |
4411 | | - ] |
4412 | | - }, |
4413 | | - { |
4414 | | - "name": "stdout", |
4415 | | - "output_type": "stream", |
4416 | | - "text": [ |
4417 | | - "torch.Size([8, 10])\n", |
4418 | | - "torch.Size([8])\n" |
4419 | | - ] |
4420 | | - }, |
4421 | | - { |
4422 | | - "name": "stderr", |
4423 | | - "output_type": "stream", |
4424 | | - "text": [ |
4425 | | - "/Users/bartz/miniforge3/envs/spotCondaEnv/lib/python3.11/site-packages/lightning/pytorch/trainer/connectors/data_connector.py:441: The 'train_dataloader' does not have many workers which may be a bottleneck. Consider increasing the value of the `num_workers` argument` to `num_workers=15` in the `DataLoader` to improve performance.\n" |
4426 | | - ] |
4427 | | - }, |
4428 | | - { |
4429 | | - "data": { |
4430 | | - "application/vnd.jupyter.widget-view+json": { |
4431 | | - "model_id": "f2089c81a3034f8181ae924de01692ca", |
4432 | | - "version_major": 2, |
4433 | | - "version_minor": 0 |
4434 | | - }, |
4435 | | - "text/plain": [ |
4436 | | - "Training: | | 0/? [00:00<?, ?it/s]" |
4437 | | - ] |
4438 | | - }, |
4439 | | - "metadata": {}, |
4440 | | - "output_type": "display_data" |
4441 | | - }, |
4442 | | - { |
4443 | | - "name": "stderr", |
4444 | | - "output_type": "stream", |
4445 | | - "text": [ |
4446 | | - "`Trainer.fit` stopped: `max_epochs=2` reached.\n", |
4447 | | - "/Users/bartz/miniforge3/envs/spotCondaEnv/lib/python3.11/site-packages/lightning/pytorch/trainer/connectors/data_connector.py:441: The 'val_dataloader' does not have many workers which may be a bottleneck. Consider increasing the value of the `num_workers` argument` to `num_workers=15` in the `DataLoader` to improve performance.\n" |
4448 | | - ] |
4449 | | - }, |
4450 | | - { |
4451 | | - "data": { |
4452 | | - "application/vnd.jupyter.widget-view+json": { |
4453 | | - "model_id": "459a96c4bed440dfafbc3d40c0e7a8d0", |
4454 | | - "version_major": 2, |
4455 | | - "version_minor": 0 |
4456 | | - }, |
4457 | | - "text/plain": [ |
4458 | | - "Validation: | | 0/? [00:00<?, ?it/s]" |
4459 | | - ] |
4460 | | - }, |
4461 | | - "metadata": {}, |
4462 | | - "output_type": "display_data" |
4463 | | - }, |
4464 | | - { |
4465 | | - "data": { |
4466 | | - "text/html": [ |
4467 | | - "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n", |
4468 | | - "┃<span style=\"font-weight: bold\"> Validate metric </span>┃<span style=\"font-weight: bold\"> DataLoader 0 </span>┃\n", |
4469 | | - "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩\n", |
4470 | | - "│<span style=\"color: #008080; text-decoration-color: #008080\"> hp_metric </span>│<span style=\"color: #800080; text-decoration-color: #800080\"> 29042.5703125 </span>│\n", |
4471 | | - "│<span style=\"color: #008080; text-decoration-color: #008080\"> val_loss </span>│<span style=\"color: #800080; text-decoration-color: #800080\"> 29042.5703125 </span>│\n", |
4472 | | - "└───────────────────────────┴───────────────────────────┘\n", |
4473 | | - "</pre>\n" |
4474 | | - ], |
4475 | | - "text/plain": [ |
4476 | | - "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n", |
4477 | | - "┃\u001b[1m \u001b[0m\u001b[1m Validate metric \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m DataLoader 0 \u001b[0m\u001b[1m \u001b[0m┃\n", |
4478 | | - "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩\n", |
4479 | | - "│\u001b[36m \u001b[0m\u001b[36m hp_metric \u001b[0m\u001b[36m \u001b[0m│\u001b[35m \u001b[0m\u001b[35m 29042.5703125 \u001b[0m\u001b[35m \u001b[0m│\n", |
4480 | | - "│\u001b[36m \u001b[0m\u001b[36m val_loss \u001b[0m\u001b[36m \u001b[0m│\u001b[35m \u001b[0m\u001b[35m 29042.5703125 \u001b[0m\u001b[35m \u001b[0m│\n", |
4481 | | - "└───────────────────────────┴───────────────────────────┘\n" |
4482 | | - ] |
4483 | | - }, |
4484 | | - "metadata": {}, |
4485 | | - "output_type": "display_data" |
4486 | | - }, |
4487 | | - { |
4488 | | - "name": "stderr", |
4489 | | - "output_type": "stream", |
4490 | | - "text": [ |
4491 | | - "/Users/bartz/miniforge3/envs/spotCondaEnv/lib/python3.11/site-packages/lightning/pytorch/trainer/connectors/data_connector.py:441: The 'test_dataloader' does not have many workers which may be a bottleneck. Consider increasing the value of the `num_workers` argument` to `num_workers=15` in the `DataLoader` to improve performance.\n" |
4492 | | - ] |
4493 | | - }, |
4494 | | - { |
4495 | | - "data": { |
4496 | | - "application/vnd.jupyter.widget-view+json": { |
4497 | | - "model_id": "9a7e5a3ceb724b9e87b9f23341122ce4", |
4498 | | - "version_major": 2, |
4499 | | - "version_minor": 0 |
4500 | | - }, |
4501 | | - "text/plain": [ |
4502 | | - "Testing: | | 0/? [00:00<?, ?it/s]" |
4503 | | - ] |
4504 | | - }, |
4505 | | - "metadata": {}, |
4506 | | - "output_type": "display_data" |
4507 | | - }, |
4508 | | - { |
4509 | | - "data": { |
4510 | | - "text/html": [ |
4511 | | - "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n", |
4512 | | - "┃<span style=\"font-weight: bold\"> Test metric </span>┃<span style=\"font-weight: bold\"> DataLoader 0 </span>┃\n", |
4513 | | - "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩\n", |
4514 | | - "│<span style=\"color: #008080; text-decoration-color: #008080\"> hp_metric </span>│<span style=\"color: #800080; text-decoration-color: #800080\"> 29042.5703125 </span>│\n", |
4515 | | - "│<span style=\"color: #008080; text-decoration-color: #008080\"> val_loss </span>│<span style=\"color: #800080; text-decoration-color: #800080\"> 29042.5703125 </span>│\n", |
4516 | | - "└───────────────────────────┴───────────────────────────┘\n", |
4517 | | - "</pre>\n" |
4518 | | - ], |
4519 | | - "text/plain": [ |
4520 | | - "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n", |
4521 | | - "┃\u001b[1m \u001b[0m\u001b[1m Test metric \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m DataLoader 0 \u001b[0m\u001b[1m \u001b[0m┃\n", |
4522 | | - "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩\n", |
4523 | | - "│\u001b[36m \u001b[0m\u001b[36m hp_metric \u001b[0m\u001b[36m \u001b[0m│\u001b[35m \u001b[0m\u001b[35m 29042.5703125 \u001b[0m\u001b[35m \u001b[0m│\n", |
4524 | | - "│\u001b[36m \u001b[0m\u001b[36m val_loss \u001b[0m\u001b[36m \u001b[0m│\u001b[35m \u001b[0m\u001b[35m 29042.5703125 \u001b[0m\u001b[35m \u001b[0m│\n", |
4525 | | - "└───────────────────────────┴───────────────────────────┘\n" |
4526 | | - ] |
4527 | | - }, |
4528 | | - "metadata": {}, |
4529 | | - "output_type": "display_data" |
4530 | | - }, |
4531 | | - { |
4532 | | - "data": { |
4533 | | - "text/plain": [ |
4534 | | - "[{'val_loss': 29042.5703125, 'hp_metric': 29042.5703125}]" |
4535 | | - ] |
4536 | | - }, |
4537 | | - "execution_count": 15, |
4538 | | - "metadata": {}, |
4539 | | - "output_type": "execute_result" |
4540 | | - } |
4541 | | - ], |
| 4366 | + "outputs": [], |
4542 | 4367 | "source": [ |
4543 | 4368 | "from torch.utils.data import DataLoader\n", |
4544 | 4369 | "from spotPython.data.diabetes import Diabetes\n", |
|
4572 | 4397 | "trainer.test(net_light_base, test_loader)" |
4573 | 4398 | ] |
4574 | 4399 | }, |
| 4400 | + { |
| 4401 | + "cell_type": "code", |
| 4402 | + "execution_count": 1, |
| 4403 | + "metadata": {}, |
| 4404 | + "outputs": [ |
| 4405 | + { |
| 4406 | + "ename": "NameError", |
| 4407 | + "evalue": "name 'MockDataSet' is not defined", |
| 4408 | + "output_type": "error", |
| 4409 | + "traceback": [ |
| 4410 | + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
| 4411 | + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", |
| 4412 | + "Cell \u001b[0;32mIn[1], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mspotPython\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mutils\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01minit\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m get_feature_names\n\u001b[0;32m----> 2\u001b[0m fun_control \u001b[38;5;241m=\u001b[39m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdata_set\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[43mMockDataSet\u001b[49m(names\u001b[38;5;241m=\u001b[39m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfeature1\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfeature2\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfeature3\u001b[39m\u001b[38;5;124m\"\u001b[39m])}\n\u001b[1;32m 3\u001b[0m get_feature_names(fun_control)\n", |
| 4413 | + "\u001b[0;31mNameError\u001b[0m: name 'MockDataSet' is not defined" |
| 4414 | + ] |
| 4415 | + } |
| 4416 | + ], |
| 4417 | + "source": [ |
| 4418 | + "from spotPython.utils.init import get_feature_names\n", |
| 4419 | + "fun_control = {\"data_set\": MockDataSet(names=[\"feature1\", \"feature2\", \"feature3\"])}\n", |
| 4420 | + "get_feature_names(fun_control)\n" |
| 4421 | + ] |
| 4422 | + }, |
4575 | 4423 | { |
4576 | 4424 | "cell_type": "code", |
4577 | 4425 | "execution_count": null, |
|
0 commit comments