From 7103856720b8aba08d020f9b1d2806765922fe35 Mon Sep 17 00:00:00 2001 From: Lauri Himanen Date: Thu, 20 Jun 2024 15:34:13 +0300 Subject: [PATCH] Update. --- .../getting_started/archive.json | 33 ++- .../getting_started/example.py | 3 +- .../getting_started/tutorial.ipynb | 262 ------------------ .../schema_packages/bayesian_optimization.py | 18 +- 4 files changed, 38 insertions(+), 278 deletions(-) delete mode 100644 src/nomad_bayesian_optimization/example_uploads/getting_started/tutorial.ipynb diff --git a/src/nomad_bayesian_optimization/example_uploads/getting_started/archive.json b/src/nomad_bayesian_optimization/example_uploads/getting_started/archive.json index e89bd35..05b008d 100644 --- a/src/nomad_bayesian_optimization/example_uploads/getting_started/archive.json +++ b/src/nomad_bayesian_optimization/example_uploads/getting_started/archive.json @@ -1,14 +1,14 @@ { "data": { "m_def": "nomad_bayesian_optimization.schema_packages.bayesian_optimization.BayesianOptimization", - "optimization": "gASVvwMAAAAAAACMEXBhbmRhcy5jb3JlLmZyYW1llIwJRGF0YUZyYW1llJOUKYGUfZQojARfbWdylIwecGFuZGFzLmNvcmUuaW50ZXJuYWxzLm1hbmFnZXJzlIwMQmxvY2tNYW5hZ2VylJOUKIwWcGFuZGFzLl9saWJzLmludGVybmFsc5SMD191bnBpY2tsZV9ibG9ja5STlIwVbnVtcHkuY29yZS5tdWx0aWFycmF5lIwMX3JlY29uc3RydWN0lJOUjAVudW1weZSMB25kYXJyYXmUk5RLAIWUQwFilIeUUpQoSwFLAUsBhpRoD4wFZHR5cGWUk5SMAk84lImIh5RSlChLA4wBfJROTk5K/////0r/////Sz90lGKJXZSMB1NpbGljb26UYXSUYowIYnVpbHRpbnOUjAVzbGljZZSTlEsASwFLAYeUUpRLAoeUUpRoC2gOaBFLAIWUaBOHlFKUKEsBSwNLAYaUaBiMAmY4lImIh5RSlChLA4wBPJROTk5K/////0r/////SwB0lGKJQxgL2B0UJzZ/QFfdIlBVafc/4aCIaXfX/D+UdJRiaCNLAUsESwGHlFKUSwKHlFKUaA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JzdHJhdGWUjAt0ZW1wZXJhdHVyZZSMDWdhc19mbG93X3JhdGWUjBByZWZyYWN0aXZlX2luZGV4lIwHQmF0Y2hOcpSMBUZpdE5ylGV0lGKMBG5hbWWUTnWGlFKUaFSMGXBhbmRhcy5jb3JlLmluZGV4ZXMucmFuZ2WUjApSYW5nZUluZGV4lJOUfZQoaGVOjAVzdGFydJRLAIwEc3RvcJRLCowEc3RlcJRLAXWGlFKUZYaUUpSMBF90eXCUjAlkYXRhZnJhbWWUjAlfbWV0YWRhdGGUXZSMBWF0dHJzlH2UjAZfZmxhZ3OUfZSMF2FsbG93c19kdXBsaWNhdGVfbGFiZWxzlIhzdWIu", "figures": [ { "label": "Optimization results", "figure": { "data": [ { - "hovertemplate": "x=%{x}
y=%{y}", + "hovertemplate": "Iteration=%{x}
refractive_index=%{y}", "legendgroup": "", "marker": { "color": "#636efa", @@ -19,11 +19,29 @@ "orientation": "v", "showlegend": false, "x": [ - NaN + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 ], "xaxis": "x", "y": [ - 1.802604114762339 + 2.079667473416009, + 0.8709893157455393, + 1.555503748783007, + 2.1257166481210845, + 1.3503182438353836, + 1.659098503962656, + 1.4384127557009232, + 2.4284166175171773, + 2.490676597333392, + 2.621132760598248 ], "yaxis": "y", "type": "scatter" @@ -875,12 +893,7 @@ ], "matches": "y", "showticklabels": false - }, - "title": { - "text": "Optimization results" - }, - "height": 400, - "width": 716 + } } } } diff --git a/src/nomad_bayesian_optimization/example_uploads/getting_started/example.py b/src/nomad_bayesian_optimization/example_uploads/getting_started/example.py index b959073..613cd84 100644 --- a/src/nomad_bayesian_optimization/example_uploads/getting_started/example.py +++ b/src/nomad_bayesian_optimization/example_uploads/getting_started/example.py @@ -107,7 +107,7 @@ def get_samples(recommendations): i = 0 result = 0 -threshold = 1 +threshold = 0.1 while abs(refractive_index_target - result) > threshold: df = campaign.recommend(batch_size=1) print('New recommendation:') @@ -136,6 +136,7 @@ def get_samples(recommendations): with open('archive.json', 'w') as fout: json.dump(archive.m_to_dict(), fout, indent=2) + # print(bopt.search_space) # campaign_dict = campaign.to_dict() # recommendation = deserialize_dataframe(campaign_dict['_cached_recommendation']) diff --git a/src/nomad_bayesian_optimization/example_uploads/getting_started/tutorial.ipynb b/src/nomad_bayesian_optimization/example_uploads/getting_started/tutorial.ipynb deleted file mode 100644 index ca25e27..0000000 --- a/src/nomad_bayesian_optimization/example_uploads/getting_started/tutorial.ipynb +++ /dev/null @@ -1,262 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "tags": [] - }, - "source": [ - "\n", - "