diff --git a/descriptor_role.ipynb b/descriptor_role.ipynb index b914182b3d0ecb361ee823e0b450066ddad3fe80..96e12bef360dbd11189076009bf4981e08343901 100644 --- a/descriptor_role.ipynb +++ b/descriptor_role.ipynb @@ -66,11 +66,11 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 1, "metadata": { "ExecuteTime": { - "end_time": "2021-05-05T17:15:21.567806Z", - "start_time": "2021-05-05T17:15:21.561479Z" + "end_time": "2021-06-22T10:48:40.475627Z", + "start_time": "2021-06-22T10:48:40.464983Z" }, "init_cell": true }, @@ -192,18 +192,33 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 2, "metadata": { "ExecuteTime": { - "end_time": "2021-05-05T17:15:21.584227Z", - "start_time": "2021-05-05T17:15:21.570909Z" + "end_time": "2021-06-22T10:48:41.270228Z", + "start_time": "2021-06-22T10:48:40.477139Z" }, "init_cell": true, "tags": [ "startup" ] }, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "ab8e7be58b394dafaa46a586048f0615", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "_ColormakerRegistry()" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "import os\n", "import math\n", @@ -229,7 +244,7 @@ "\n", "from descriptor_role.utils import generate_structures\n", "from descriptor_role.visualizer import Visualizer\n", - "from cpp_sisso import generate_fs, SISSORegressor, generate_phi_0_from_csv, FeatureSpace, get_max_number_feats\n", + "from sissopp import generate_fs, SISSORegressor, generate_phi_0_from_csv, FeatureSpace, get_max_number_feats\n", "\n", "import timeit\n", "\n", @@ -240,11 +255,11 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 3, "metadata": { "ExecuteTime": { - "end_time": "2021-05-05T17:15:21.681574Z", - "start_time": "2021-05-05T17:15:21.588239Z" + "end_time": "2021-06-22T10:48:41.374896Z", + "start_time": "2021-06-22T10:48:41.272479Z" }, "init_cell": true, "tags": [ @@ -304,11 +319,11 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 4, "metadata": { "ExecuteTime": { - "end_time": "2021-05-05T17:15:21.688433Z", - "start_time": "2021-05-05T17:15:21.683538Z" + "end_time": "2021-06-22T10:48:41.381302Z", + "start_time": "2021-06-22T10:48:41.376533Z" }, "init_cell": true, "tags": [ @@ -328,24 +343,33 @@ " n_residual=1,\n", " default=True,\n", "):\n", - " phi_0, prop_unit, prop, prop_test, task_sizes_train, task_sizes_test, leave_out_inds = generate_phi_0_from_csv(\n", - " df, \"energy_diff\", cols=cols, task_key=None, leave_out_frac=0.0, leave_out_inds=None\n", + " phi_0, prop_label, prop_unit, prop, prop_test, task_sizes_train, task_sizes_test, leave_out_inds = generate_phi_0_from_csv(\n", + " df, \n", + " \"energy_diff\", \n", + " cols=cols, \n", + " task_key=None, \n", + " leave_out_frac=0.0, \n", + " leave_out_inds=None,\n", + " max_rung=max_phi\n", " )\n", " if default:\n", " feat_space = FeatureSpace(\n", " \"./data/descriptor_role/phi.txt\",\n", " phi_0,\n", + " prop,\n", " task_sizes_train,\n", " \"regression\",\n", " n_sis_select,\n", " 1.0\n", - " )\n", + "\n", + " ) \n", " else:\n", " feat_space = generate_fs(\n", " phi_0,\n", " prop,\n", " task_sizes_train,\n", " ops,\n", + " [],\n", " 'regression',\n", " max_phi,\n", " n_sis_select\n", @@ -353,6 +377,7 @@ "\n", " sisso = SISSORegressor(\n", " feat_space,\n", + " prop_label,\n", " prop_unit,\n", " prop,\n", " prop_test,\n", @@ -368,11 +393,11 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 5, "metadata": { "ExecuteTime": { - "end_time": "2021-05-05T17:15:21.704466Z", - "start_time": "2021-05-05T17:15:21.689971Z" + "end_time": "2021-06-22T10:48:41.445924Z", + "start_time": "2021-06-22T10:48:41.383134Z" }, "init_cell": true, "tags": [ @@ -515,11 +540,11 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 6, "metadata": { "ExecuteTime": { - "end_time": "2021-05-05T17:15:22.045665Z", - "start_time": "2021-05-05T17:15:21.705668Z" + "end_time": "2021-06-22T10:48:41.754738Z", + "start_time": "2021-06-22T10:48:41.447437Z" }, "init_cell": true, "scrolled": false, @@ -531,7 +556,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "d76b43ff68f9462cbd3bdf8d8b3f48fc", + "model_id": "39f9d9050fb64fe3aa933846ed87a4f1", "version_major": 2, "version_minor": 0 }, @@ -627,13 +652,6 @@ "display(out_box)" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "code", "execution_count": null, diff --git a/descriptor_role/visualizer.py b/descriptor_role/visualizer.py index f46e3093d66e5b8ea2041afdba1b0a1a8461c5e4..1e7927b60013a678f6eb0f97ab5acc1b5cba6502 100644 --- a/descriptor_role/visualizer.py +++ b/descriptor_role/visualizer.py @@ -54,7 +54,7 @@ class Visualizer: self.feat_space = feat_space self.total_features = sisso.n_dim self.feat_val_list = list(reversed([feat.value for feat in sisso.models[sisso.n_dim - 1][0].feats])) - self.features = list(reversed([str(feat) for feat in sisso.models[sisso.n_dim - 1][0].feats])) + self.features = list(reversed([str(feat.expr) for feat in sisso.models[sisso.n_dim - 1][0].feats])) self.df_selected = pd.DataFrame() for feat, values in zip(self.features, self.feat_val_list): self.df_selected[feat] = values