{"id":668,"date":"2024-11-03T22:31:16","date_gmt":"2024-11-03T21:31:16","guid":{"rendered":"https:\/\/idea.gm.th-koeln.de\/?p=668"},"modified":"2024-11-03T22:34:34","modified_gmt":"2024-11-03T21:34:34","slug":"spotpython-0-16-9-released","status":"publish","type":"post","link":"https:\/\/www.spotseven.de\/?p=668","title":{"rendered":"spotpython-0.16.9 released"},"content":{"rendered":"\n<p>Changes in spotpython-0.16.9:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>xai.py: add new function viz_net to visualize the network architecture (linear nets).<\/li>\n\n\n\n<li>dimensions.py: add new function extract_linear_dims that extracts the input and output dimensions of the Linear layers in a PyTorch model.<\/li>\n<\/ul>\n\n\n\n<p>Here is an example which demonstrates the usage of the <code>viz_net()<\/code> function:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from spotpython.plot.xai import viz_net\nfrom spotpython.utils.init import fun_control_init\nfrom spotpython.data.diabetes import Diabetes\nfrom spotpython.light.regression.nn_linear_regressor import NNLinearRegressor\nfrom spotpython.hyperdict.light_hyper_dict import LightHyperDict\nfrom spotpython.hyperparameters.values import (\n        get_default_hyperparameters_as_array, get_one_config_from_X)\nfrom spotpython.hyperdict.light_hyper_dict import LightHyperDict\n_L_in=10\n_L_out=1\n_torchmetric=\"mean_squared_error\"\nfun_control = fun_control_init(\n    _L_in=_L_in,\n    _L_out=_L_out,\n    _torchmetric=_torchmetric,\n    data_set=Diabetes(),\n    core_model=NNLinearRegressor,\n    hyperdict=LightHyperDict)\nX = get_default_hyperparameters_as_array(fun_control)\nconfig = get_one_config_from_X(X, fun_control)\nmodel = fun_control&#91;\"core_model\"](**config, _L_in=_L_in, _L_out=_L_out, _torchmetric=_torchmetric)\nviz_net(net=model, device=\"cpu\", show_attrs=True, show_saved=True, filename=\"model_architecture\", format=\"png\")<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"455\" height=\"1024\" data-attachment-id=\"669\" data-permalink=\"https:\/\/www.spotseven.de\/?attachment_id=669\" data-orig-file=\"https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?fit=1056%2C2376&amp;ssl=1\" data-orig-size=\"1056,2376\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"model_architecture\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?fit=455%2C1024&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/idea.gm.th-koeln.de\/wp-content\/uploads\/2024\/11\/model_architecture-455x1024.png?resize=455%2C1024&#038;ssl=1\" alt=\"\" class=\"wp-image-669\" srcset=\"https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?resize=455%2C1024&amp;ssl=1 455w, https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?resize=333%2C750&amp;ssl=1 333w, https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?resize=222%2C500&amp;ssl=1 222w, https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?resize=768%2C1728&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?resize=683%2C1536&amp;ssl=1 683w, https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?resize=910%2C2048&amp;ssl=1 910w, https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?resize=533%2C1200&amp;ssl=1 533w, https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?resize=560%2C1260&amp;ssl=1 560w, https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?w=1056&amp;ssl=1 1056w\" sizes=\"auto, (max-width: 455px) 100vw, 455px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Spotpython-0.16.9 introduces two key features: a new function, viz_net, for visualizing linear network architectures, and extract_linear_dims, which retrieves input and output dimensions of Linear layers in PyTorch models. An illustrative example demonstrates the implementation of viz_net alongside model initialization and configuration using the Diabetes dataset.<\/p>\n","protected":false},"author":3,"featured_media":669,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":false,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[47,53,54],"tags":[],"class_list":["post-668","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hyperparameter-tuning","category-software","category-spot",""],"acf":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.spotseven.de\/wp-content\/uploads\/2024\/11\/model_architecture.png?fit=1056%2C2376&ssl=1","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/p2DCPK-aM","_links":{"self":[{"href":"https:\/\/www.spotseven.de\/index.php?rest_route=\/wp\/v2\/posts\/668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.spotseven.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.spotseven.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.spotseven.de\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.spotseven.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=668"}],"version-history":[{"count":3,"href":"https:\/\/www.spotseven.de\/index.php?rest_route=\/wp\/v2\/posts\/668\/revisions"}],"predecessor-version":[{"id":672,"href":"https:\/\/www.spotseven.de\/index.php?rest_route=\/wp\/v2\/posts\/668\/revisions\/672"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.spotseven.de\/index.php?rest_route=\/wp\/v2\/media\/669"}],"wp:attachment":[{"href":"https:\/\/www.spotseven.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.spotseven.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.spotseven.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}