Skip to content

Commit f8fabe0

Browse files
new hyperdict dir
1 parent d74d441 commit f8fabe0

9 files changed

Lines changed: 416 additions & 151 deletions

File tree

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include src/spotPython/data/*.csv
22
include src/spotPython/data/*.json
33
include src/spotPython/data/*.pkl
4+
include src/spotPython/hyperdict/*.json

notebooks/00_spotPython_tests.ipynb

Lines changed: 107 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@
247247
},
248248
{
249249
"cell_type": "code",
250-
"execution_count": 1,
250+
"execution_count": null,
251251
"metadata": {},
252252
"outputs": [],
253253
"source": [
@@ -427,7 +427,7 @@
427427
},
428428
{
429429
"cell_type": "code",
430-
"execution_count": 3,
430+
"execution_count": null,
431431
"metadata": {},
432432
"outputs": [],
433433
"source": [
@@ -467,17 +467,9 @@
467467
},
468468
{
469469
"cell_type": "code",
470-
"execution_count": 5,
470+
"execution_count": null,
471471
"metadata": {},
472-
"outputs": [
473-
{
474-
"name": "stdout",
475-
"output_type": "stream",
476-
"text": [
477-
"11\n"
478-
]
479-
}
480-
],
472+
"outputs": [],
481473
"source": [
482474
"from spotPython.data.lightdatamodule import LightDataModule\n",
483475
"from spotPython.data.csvdataset import CSVDataset\n",
@@ -490,7 +482,7 @@
490482
},
491483
{
492484
"cell_type": "code",
493-
"execution_count": 6,
485+
"execution_count": null,
494486
"metadata": {},
495487
"outputs": [],
496488
"source": [
@@ -499,71 +491,36 @@
499491
},
500492
{
501493
"cell_type": "code",
502-
"execution_count": 7,
494+
"execution_count": null,
503495
"metadata": {},
504-
"outputs": [
505-
{
506-
"name": "stdout",
507-
"output_type": "stream",
508-
"text": [
509-
"full_train_size: 4\n",
510-
"val_size: 2\n",
511-
"train_size: 2\n",
512-
"test_size: 7\n"
513-
]
514-
}
515-
],
496+
"outputs": [],
516497
"source": [
517498
"data_module.setup()"
518499
]
519500
},
520501
{
521502
"cell_type": "code",
522-
"execution_count": 8,
503+
"execution_count": null,
523504
"metadata": {},
524-
"outputs": [
525-
{
526-
"name": "stdout",
527-
"output_type": "stream",
528-
"text": [
529-
"Training set size: 2\n"
530-
]
531-
}
532-
],
505+
"outputs": [],
533506
"source": [
534507
"print(f\"Training set size: {len(data_module.data_train)}\")"
535508
]
536509
},
537510
{
538511
"cell_type": "code",
539-
"execution_count": 9,
512+
"execution_count": null,
540513
"metadata": {},
541-
"outputs": [
542-
{
543-
"name": "stdout",
544-
"output_type": "stream",
545-
"text": [
546-
"Validation set size: 2\n"
547-
]
548-
}
549-
],
514+
"outputs": [],
550515
"source": [
551516
"print(f\"Validation set size: {len(data_module.data_val)}\")"
552517
]
553518
},
554519
{
555520
"cell_type": "code",
556-
"execution_count": 10,
521+
"execution_count": null,
557522
"metadata": {},
558-
"outputs": [
559-
{
560-
"name": "stdout",
561-
"output_type": "stream",
562-
"text": [
563-
"Test set size: 7\n"
564-
]
565-
}
566-
],
523+
"outputs": [],
567524
"source": [
568525
"print(f\"Test set size: {len(data_module.data_test)}\")"
569526
]
@@ -613,28 +570,9 @@
613570
},
614571
{
615572
"cell_type": "code",
616-
"execution_count": 13,
573+
"execution_count": null,
617574
"metadata": {},
618-
"outputs": [
619-
{
620-
"name": "stderr",
621-
"output_type": "stream",
622-
"text": [
623-
"Seed set to 42\n"
624-
]
625-
},
626-
{
627-
"name": "stdout",
628-
"output_type": "stream",
629-
"text": [
630-
"full_train_size: 56925\n",
631-
"val_size: 76\n",
632-
"train_size: 56849\n",
633-
"test_size: 77\n",
634-
"Test set size: 77\n"
635-
]
636-
}
637-
],
575+
"outputs": [],
638576
"source": [
639577
"from spotPython.utils.init import fun_control_init\n",
640578
"from spotPython.hyperparameters.values import set_data_module\n",
@@ -660,28 +598,9 @@
660598
},
661599
{
662600
"cell_type": "code",
663-
"execution_count": 15,
601+
"execution_count": null,
664602
"metadata": {},
665-
"outputs": [
666-
{
667-
"name": "stderr",
668-
"output_type": "stream",
669-
"text": [
670-
"Seed set to 42\n"
671-
]
672-
},
673-
{
674-
"name": "stdout",
675-
"output_type": "stream",
676-
"text": [
677-
"full_train_size: 630\n",
678-
"val_size: 68\n",
679-
"train_size: 562\n",
680-
"test_size: 77\n",
681-
"Test set size: 77\n"
682-
]
683-
}
684-
],
603+
"outputs": [],
685604
"source": [
686605
"from spotPython.utils.init import fun_control_init\n",
687606
"from spotPython.hyperparameters.values import set_data_module\n",
@@ -698,6 +617,96 @@
698617
"print(f\"Test set size: {len(data_module.data_test)}\")\n"
699618
]
700619
},
620+
{
621+
"cell_type": "markdown",
622+
"metadata": {},
623+
"source": [
624+
"# load Hyperdict"
625+
]
626+
},
627+
{
628+
"cell_type": "code",
629+
"execution_count": null,
630+
"metadata": {},
631+
"outputs": [],
632+
"source": [
633+
"from spotPython.hyperdict.light_hyper_dict import LightHyperDict\n",
634+
"lhd = LightHyperDict()\n",
635+
"lhd.hyper_dict\n",
636+
"user_lhd = LightHyperDict(filename=\"user_hyper_dict.json\", directory=\"./hyperdict/\")\n",
637+
"user_lhd.hyper_dict\n"
638+
]
639+
},
640+
{
641+
"cell_type": "code",
642+
"execution_count": null,
643+
"metadata": {},
644+
"outputs": [],
645+
"source": []
646+
},
647+
{
648+
"cell_type": "markdown",
649+
"metadata": {},
650+
"source": [
651+
"# add core model to fun control"
652+
]
653+
},
654+
{
655+
"cell_type": "code",
656+
"execution_count": 8,
657+
"metadata": {},
658+
"outputs": [
659+
{
660+
"name": "stderr",
661+
"output_type": "stream",
662+
"text": [
663+
"Seed set to 42\n"
664+
]
665+
},
666+
{
667+
"data": {
668+
"text/plain": [
669+
"'NetLightBase'"
670+
]
671+
},
672+
"execution_count": 8,
673+
"metadata": {},
674+
"output_type": "execute_result"
675+
}
676+
],
677+
"source": [
678+
"from spotPython.light.netlightbase import NetLightBase\n",
679+
"from spotPython.utils.init import fun_control_init\n",
680+
"from spotPython.hyperdict.light_hyper_dict import LightHyperDict\n",
681+
"from spotPython.hyperparameters.values import add_core_model_to_fun_control\n",
682+
"fun_control = fun_control_init()\n",
683+
"add_core_model_to_fun_control(core_model=NetLightBase,\n",
684+
" fun_control=fun_control,\n",
685+
" hyper_dict=LightHyperDict)\n",
686+
"fun_control[\"core_model\"].__name__"
687+
]
688+
},
689+
{
690+
"cell_type": "code",
691+
"execution_count": 12,
692+
"metadata": {},
693+
"outputs": [
694+
{
695+
"data": {
696+
"text/plain": [
697+
"True"
698+
]
699+
},
700+
"execution_count": 12,
701+
"metadata": {},
702+
"output_type": "execute_result"
703+
}
704+
],
705+
"source": [
706+
"# check if the fun_control[\"core_model_hyper_dict\"] is a LightHyperDict\n",
707+
"isinstance(fun_control[\"core_model_hyper_dict\"], dict)"
708+
]
709+
},
701710
{
702711
"cell_type": "code",
703712
"execution_count": null,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "spotPython"
10-
version = "0.6.49"
10+
version = "0.6.50"
1111
authors = [
1212
{ name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" }
1313
]

src/spotPython/data/light_hyper_dict.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)