|
247 | 247 | }, |
248 | 248 | { |
249 | 249 | "cell_type": "code", |
250 | | - "execution_count": 1, |
| 250 | + "execution_count": null, |
251 | 251 | "metadata": {}, |
252 | 252 | "outputs": [], |
253 | 253 | "source": [ |
|
427 | 427 | }, |
428 | 428 | { |
429 | 429 | "cell_type": "code", |
430 | | - "execution_count": 3, |
| 430 | + "execution_count": null, |
431 | 431 | "metadata": {}, |
432 | 432 | "outputs": [], |
433 | 433 | "source": [ |
|
467 | 467 | }, |
468 | 468 | { |
469 | 469 | "cell_type": "code", |
470 | | - "execution_count": 5, |
| 470 | + "execution_count": null, |
471 | 471 | "metadata": {}, |
472 | | - "outputs": [ |
473 | | - { |
474 | | - "name": "stdout", |
475 | | - "output_type": "stream", |
476 | | - "text": [ |
477 | | - "11\n" |
478 | | - ] |
479 | | - } |
480 | | - ], |
| 472 | + "outputs": [], |
481 | 473 | "source": [ |
482 | 474 | "from spotPython.data.lightdatamodule import LightDataModule\n", |
483 | 475 | "from spotPython.data.csvdataset import CSVDataset\n", |
|
490 | 482 | }, |
491 | 483 | { |
492 | 484 | "cell_type": "code", |
493 | | - "execution_count": 6, |
| 485 | + "execution_count": null, |
494 | 486 | "metadata": {}, |
495 | 487 | "outputs": [], |
496 | 488 | "source": [ |
|
499 | 491 | }, |
500 | 492 | { |
501 | 493 | "cell_type": "code", |
502 | | - "execution_count": 7, |
| 494 | + "execution_count": null, |
503 | 495 | "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": [], |
516 | 497 | "source": [ |
517 | 498 | "data_module.setup()" |
518 | 499 | ] |
519 | 500 | }, |
520 | 501 | { |
521 | 502 | "cell_type": "code", |
522 | | - "execution_count": 8, |
| 503 | + "execution_count": null, |
523 | 504 | "metadata": {}, |
524 | | - "outputs": [ |
525 | | - { |
526 | | - "name": "stdout", |
527 | | - "output_type": "stream", |
528 | | - "text": [ |
529 | | - "Training set size: 2\n" |
530 | | - ] |
531 | | - } |
532 | | - ], |
| 505 | + "outputs": [], |
533 | 506 | "source": [ |
534 | 507 | "print(f\"Training set size: {len(data_module.data_train)}\")" |
535 | 508 | ] |
536 | 509 | }, |
537 | 510 | { |
538 | 511 | "cell_type": "code", |
539 | | - "execution_count": 9, |
| 512 | + "execution_count": null, |
540 | 513 | "metadata": {}, |
541 | | - "outputs": [ |
542 | | - { |
543 | | - "name": "stdout", |
544 | | - "output_type": "stream", |
545 | | - "text": [ |
546 | | - "Validation set size: 2\n" |
547 | | - ] |
548 | | - } |
549 | | - ], |
| 514 | + "outputs": [], |
550 | 515 | "source": [ |
551 | 516 | "print(f\"Validation set size: {len(data_module.data_val)}\")" |
552 | 517 | ] |
553 | 518 | }, |
554 | 519 | { |
555 | 520 | "cell_type": "code", |
556 | | - "execution_count": 10, |
| 521 | + "execution_count": null, |
557 | 522 | "metadata": {}, |
558 | | - "outputs": [ |
559 | | - { |
560 | | - "name": "stdout", |
561 | | - "output_type": "stream", |
562 | | - "text": [ |
563 | | - "Test set size: 7\n" |
564 | | - ] |
565 | | - } |
566 | | - ], |
| 523 | + "outputs": [], |
567 | 524 | "source": [ |
568 | 525 | "print(f\"Test set size: {len(data_module.data_test)}\")" |
569 | 526 | ] |
|
613 | 570 | }, |
614 | 571 | { |
615 | 572 | "cell_type": "code", |
616 | | - "execution_count": 13, |
| 573 | + "execution_count": null, |
617 | 574 | "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": [], |
638 | 576 | "source": [ |
639 | 577 | "from spotPython.utils.init import fun_control_init\n", |
640 | 578 | "from spotPython.hyperparameters.values import set_data_module\n", |
|
660 | 598 | }, |
661 | 599 | { |
662 | 600 | "cell_type": "code", |
663 | | - "execution_count": 15, |
| 601 | + "execution_count": null, |
664 | 602 | "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": [], |
685 | 604 | "source": [ |
686 | 605 | "from spotPython.utils.init import fun_control_init\n", |
687 | 606 | "from spotPython.hyperparameters.values import set_data_module\n", |
|
698 | 617 | "print(f\"Test set size: {len(data_module.data_test)}\")\n" |
699 | 618 | ] |
700 | 619 | }, |
| 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 | + }, |
701 | 710 | { |
702 | 711 | "cell_type": "code", |
703 | 712 | "execution_count": null, |
|
0 commit comments