From 1d57dc5c70c3076b566e8315926f69da0dae267e Mon Sep 17 00:00:00 2001 From: Luigi Sbailo <sbailo@fhi-berlin.mpg.de> Date: Tue, 15 Sep 2020 15:46:02 +0200 Subject: [PATCH] Minor --- descriptor_role.ipynb | 87 ++++++++++++++++++++++------------- descriptor_role/visualizer.py | 12 +---- 2 files changed, 56 insertions(+), 43 deletions(-) diff --git a/descriptor_role.ipynb b/descriptor_role.ipynb index 39a3ce7..6bc34eb 100644 --- a/descriptor_role.ipynb +++ b/descriptor_role.ipynb @@ -66,11 +66,11 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 43, "metadata": { "ExecuteTime": { - "end_time": "2020-09-08T16:36:45.838092Z", - "start_time": "2020-09-08T16:36:45.831885Z" + "end_time": "2020-09-15T13:44:08.343926Z", + "start_time": "2020-09-15T13:44:08.337929Z" }, "init_cell": true }, @@ -184,20 +184,19 @@ "source": [ "The idea demonstrated in this tutorial is to start from simple physical quantities (\"primary features\", here properties of the constituent free atoms such as orbital radii), to generate millions (or billions) of candidate formulas by applying arithmetic operations combining primary features. These candidate formulas constitute the so-called \"feature space\". Then, SISSO is used to select only a few of these formulas that explain the data.\n", "\n", - "By clicking directly on \"Run\" below, you can reproduce results from the above publication, or you can modify the settings to produce your own results. To the purpose, in the panel below, you can select primary features and allowed operations by clicking the check-boxes. You can also select the SISSO rung (i.e., the number of iterations in the construction of the feature space), the number of features that are selected at each iteration of the SIS step, and the max number of dimensions of the model. Then, press \"Run\". After the results are shown for all models from one dimensional to the max chosen dimension, you can press \"Plot interactive map\" to reveal a map of the RS vs ZB relative stability, for the highest dimensional model. If the highest dimension model is 2D, the separation line between the two phases (i.e., the locus where the predicted $\\Delta$E is zero) is shown. For higher dimensional models, the 3rd and 4th dimensions can be controlled by the size of the Marker or the Color. Drop-down menus allow to assign axes, markers, and colors, to the descriptor components of choice\n", + "By clicking directly on \"Run\" below, you can reproduce the 2D map as published in <a href=\"http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.114.10550\" target=\"_blank\">PRL 2015</a>. You can also select primary features and allowed operations (by clicking the check-boxes), as well as the SISSO rung (i.e., the number of iterations in the construction of the feature space), the number of features that are selected at each iteration of the SIS step, and the max number of dimensions of the model. Then press \"Run\". \\\n", + "After the results are shown for all models from one dimensional to the max chosen dimension, you can press \"Plot interactive map\" to reveal a map of the RS vs ZB relative stability, for the highest dimensional model. If the highest dimension model is 2D, the separation line between the two phases (i.e., the locus where the predicted $\\Delta$E is zero) is shown. For higher dimensional models, the 3rd and 4th dimensions can be visualized via the size or the color of the data-point markers. Intuitive drop-down menus allow to assign axes, markers, and colors, to the descriptor components of choice.\n", "\n", - "\n", - "By running the tutorial with the default setting, the (RS vs. ZB) results of the <a href=\"http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.114.10550\" target=\"_blank\">PRL 2015</a> identified by the LASSO+$\\ell_0$ method can be recovered. SISSO and LASSO+$\\ell_0$ do not always yield the same results (see <a href=\"http://analytics-toolkit.nomad-coe.eu/tutorial-SIS\">compressed-sensing tutorial</a>) but in this case the default model parameters were tuned to obtain the same results.\n", - "Additionally, in <a href=\"http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.114.10550\" target=\"_blank\">PRL-2015</a>, a slightly different criterion for the construction of the feature set was adopted, compared to <a href=\"https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.2.083802\" target=\"_blank\">PRM-2018</a>. For the sake of reproducing exactly the results of <a href=\"http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.114.10550\" target=\"_blank\">PRL-2015</a>, the default settings in the input widget include \"PRL2015\" as choice for \"SISSO rung\". In order to unlock the feature and operator selection, first select a rung different from \"PRL2015\"." + "With the selection of \"PRL2015\" as SISSO rung, a special feature space is uploaded, which allows for the reproduction of also the 1D and 3D models as published in <a href=\"http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.114.10550\" target=\"_blank\">PRL 2015</a> . This is because in <a href=\"http://journals.aps.org/prl/abstract/10.1103/PhysRevLett.114.10550\" target=\"_blank\">PRL-2015</a> a slightly different criterion for the construction of the feature set was adopted, compared to <a href=\"https://journals.aps.org/prmaterials/abstract/10.1103/PhysRevMaterials.2.083802\" target=\"_blank\">PRM-2018</a>." ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 44, "metadata": { "ExecuteTime": { - "end_time": "2020-09-08T16:36:45.855476Z", - "start_time": "2020-09-08T16:36:45.842007Z" + "end_time": "2020-09-15T13:44:08.365709Z", + "start_time": "2020-09-15T13:44:08.350670Z" }, "init_cell": true, "tags": [ @@ -238,11 +237,11 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 45, "metadata": { "ExecuteTime": { - "end_time": "2020-09-08T16:36:45.953707Z", - "start_time": "2020-09-08T16:36:45.857052Z" + "end_time": "2020-09-15T13:44:08.464959Z", + "start_time": "2020-09-15T13:44:08.369045Z" }, "init_cell": true, "tags": [ @@ -302,11 +301,11 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 46, "metadata": { "ExecuteTime": { - "end_time": "2020-09-08T16:36:45.957601Z", - "start_time": "2020-09-08T16:36:45.955224Z" + "end_time": "2020-09-15T13:44:08.470307Z", + "start_time": "2020-09-15T13:44:08.467181Z" }, "init_cell": true, "tags": [ @@ -326,11 +325,11 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 47, "metadata": { "ExecuteTime": { - "end_time": "2020-09-08T16:36:45.975731Z", - "start_time": "2020-09-08T16:36:45.958855Z" + "end_time": "2020-09-15T13:44:08.489127Z", + "start_time": "2020-09-15T13:44:08.472175Z" }, "init_cell": true, "tags": [ @@ -388,11 +387,11 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 48, "metadata": { "ExecuteTime": { - "end_time": "2020-09-08T16:36:45.988530Z", - "start_time": "2020-09-08T16:36:45.977227Z" + "end_time": "2020-09-15T13:44:08.510309Z", + "start_time": "2020-09-15T13:44:08.490960Z" }, "init_cell": true, "tags": [ @@ -403,7 +402,17 @@ "source": [ "def prl_select(change):\n", " if change['new'] == 'PRL2015':\n", - " default_selection('')\n", + " default_operations = ['add','abs_diff','exp','sq','div']\n", + " default_features = ['IP','EA','r_s','r_p','r_d']\n", + " for op, widget in zip(possible_operations, op_list):\n", + " widget.value = op in default_operations\n", + " widget.disabled = True\n", + " for feat, widget in zip(possible_features, feat_list):\n", + " widget.value = feat in default_features\n", + " widget.disabled = True\n", + " tier_selection.value = 'PRL2015'\n", + " feat_per_iter_selection.value = 50\n", + " dimension_selection.value = 2 \n", " else:\n", " for widget in op_list+feat_list:\n", " widget.disabled = False\n", @@ -413,12 +422,12 @@ " default_features = ['IP','EA','r_s','r_p','r_d']\n", " for op, widget in zip(possible_operations, op_list):\n", " widget.value = op in default_operations\n", - " widget.disabled = True\n", + " widget.disabled = False\n", " for feat, widget in zip(possible_features, feat_list):\n", " widget.value = feat in default_features\n", - " widget.disabled = True\n", - " tier_selection.value = 'PRL2015'\n", - " feat_per_iter_selection.value = 50\n", + " widget.disabled = False\n", + " tier_selection.value = 2\n", + " feat_per_iter_selection.value = 30\n", " dimension_selection.value = 2\n", " \n", "def find_descriptors(b):\n", @@ -490,11 +499,11 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 49, "metadata": { "ExecuteTime": { - "end_time": "2020-09-08T16:36:46.292035Z", - "start_time": "2020-09-08T16:36:45.989512Z" + "end_time": "2020-09-15T13:44:08.797738Z", + "start_time": "2020-09-15T13:44:08.511662Z" }, "init_cell": true, "scrolled": false, @@ -506,12 +515,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "ab40adb717384a099214dbf571713e57", + "model_id": "fc623fc7daa64d22bf4b70cdef924a66", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "VBox(children=(HBox(children=(VBox(children=(Label(value=''), Checkbox(value=True, disabled=True, indent=False…" + "VBox(children=(HBox(children=(VBox(children=(Label(value=''), Checkbox(value=True, indent=False, layout=Layout…" ] }, "metadata": {}, @@ -600,6 +609,20 @@ "default_selection('')\n", "display(out_box)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/descriptor_role/visualizer.py b/descriptor_role/visualizer.py index 6606573..f46e309 100644 --- a/descriptor_role/visualizer.py +++ b/descriptor_role/visualizer.py @@ -345,8 +345,6 @@ class Visualizer: string = 'rgb(' + str(value) + "," + str(value2) + "," + str(0) + ')' self.ZB_colors[i] = string - - def handle_xfeat_change(self, change): # changes the feature plotted on the x-axis # separating line is modified accordingly @@ -751,16 +749,9 @@ class Visualizer: self.widg_box_utils.layout.visibility = 'hidden' self.widg_gradient.layout.visibility = 'hidden' - # box_print.layout.border = 'dashed 1px' - # self.box_print.layout.max_width = '750px' - - - # self.box_print.layout.height = '110px' self.box_feat.layout.height = '110px' self.box_feat.layout.top = '30px' - # box_print.layout.top = '30px' self.widg_plotutils_button.layout.left = '50px' - # self.widg_plotutils_button.layout.top='30px' self.widg_box_utils.layout.border = 'dashed 1px' self.widg_box_utils.right = '100px' @@ -769,7 +760,6 @@ class Visualizer: container = widgets.VBox([ self.box_feat, self.fig, self.widg_plotutils_button, - self.widg_box_viewers, self.widg_box_utils ]) @@ -969,7 +959,7 @@ class Visualizer: layout=widgets.Layout(left='50px', width='640px') ) self.widg_plotutils_button = widgets.Button( - description='Toggle on/off the plot appearance utils', + description='For a high-quality print of the plot, click to access the plot appearance utils', layout=widgets.Layout(width='600px') ) self.widg_box_utils = widgets.VBox([widgets.HBox([self.widg_markersize, self.widg_crosssize, -- GitLab