{ "cells": [ { "cell_type": "code", "id": "initial_id", "metadata": { "collapsed": true, "ExecuteTime": { "end_time": "2025-01-21T09:41:42.114098Z", "start_time": "2025-01-21T09:41:41.778362Z" } }, "source": "import optuna", "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/work/gkrzmanc/1gatr/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "execution_count": 1 }, { "metadata": { "ExecuteTime": { "end_time": "2025-01-21T09:41:42.412127Z", "start_time": "2025-01-21T09:41:42.282001Z" } }, "cell_type": "code", "source": [ "studies = {\n", " \"LGATr_rinv_03_m_900\": \"/work/gkrzmanc/jetclustering/results/train/Eval_LGATr_ValidationSetSTD2_2025_01_13_17_40_58/clustering_tuning_3.log\",\n", " \"LGATr_rinv_03_m_900_spatial_only\": \"/work/gkrzmanc/jetclustering/results/train/Eval_LGATr_ValidationSetSTD2_2025_01_13_17_40_58/clustering_tuning_3_sp_comp_only.log\",\n", " #\"LGATr_cos_sim\": \"/work/gkrzmanc/jetclustering/results/train/Eval_LGATr_ValidationSetSTD2_2025_01_13_17_40_58/clustering_tuning_3_cos_sim.log\",\n", " #\"LGATr_L_cos_sim\": \"/work/gkrzmanc/jetclustering/results/train/Eval_LGATr_ValidationSetSTD2_2025_01_13_17_40_58/clustering_tuning_3_lorentz_cos_sim.log\",\n", " \"Identity_rinv_03_m_900\": \"/work/gkrzmanc/jetclustering/results/train/Eval_Identity_ValSet_STD2_2025_01_13_17_59_01/clustering_tuning_3.log\",\n", " \"LGATr_cos_sim\": \"/work/gkrzmanc/jetclustering/results/train/Eval_Quark_dist_loss_2025_01_18_13_11_16/clustering_tuning_3_cos_sim.log\",\n", " \"LGATr_qd_norm\": \"/work/gkrzmanc/jetclustering/results/train/Eval_Quark_dist_loss_2025_01_18_13_11_16/clustering_tuning_3_norm.log\",\n", " \"lgatr_no_coords_loss\": \"/work/gkrzmanc/jetclustering/results/train/Eval_LGATr_no_coords_loss_1_2025_01_20_16_22_21/clustering_tuning_3_sp_comp_only.log\",\n", " # clustering_tuning_3_norm.log\n", "}\n", "studies = {key: optuna.load_study(study_name=\"clustering\", storage=optuna.storages.JournalStorage(\n", " optuna.storages.journal.JournalFileBackend(studies[key])\n", ")) for key in studies}" ], "id": "8f347dab4e47fecb", "outputs": [], "execution_count": 2 }, { "metadata": { "ExecuteTime": { "end_time": "2025-01-20T14:00:42.610682Z", "start_time": "2025-01-20T14:00:42.563361Z" } }, "cell_type": "code", "source": [ "\n", "# Visualize the study\n", "study = studies[\"LGATr_rinv_03_m_900\"]\n", "print(study.best_params)\n", "# best value:\n", "print(study.best_value)\n", "suffix = \"{}-{}-{}\".format(study.best_params[\"min_cluster_size\"], study.best_params[\"min_samples\"], study.best_params[\"epsilon\"])\n", "print(suffix)\n", "optuna.visualization.plot_optimization_history(study)\n" ], "id": "34b0b005d1e3ac5a", "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'min_cluster_size': 11, 'min_samples': 18, 'epsilon': 0.47532971250006545}\n", "0.7560372377379465\n", "11-18-0.47532971250006545\n" ] }, { "data": { "application/vnd.plotly.v1+json": { "data": [ { "mode": "markers", "name": "Objective Value", "x": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103 ], "y": [ 0.7527412434448526, 0.7416098985124426, 0.7526683431126012, 0.7517276251474801, 0.732224163111022, 0.7546770011431121, 0.7089335534931389, 0.7492181229415185, 0.7513066563424683, 0.750772141684521, 0.7489077501043551, 0.7495501481050854, 0.7386985721541848, 0.7376711362032463, 0.7346163657492703, 0.7346163657492703, 0.7376711362032463, 0.7356908081151536, 0.7534128506686685, 0.7534128506686685, 0.7529713029198096, 0.7531135939371988, 0.7535319196366373, 0.7528052252554011, 0.7531135939371988, 0.7530709450990224, 0.7528262386601534, 0.7529378925331471, 0.7550077898953929, 0.7548048922539313, 0.7533900890158343, 0.7491105181231932, 0.7494443209602134, 0.7538926975491965, 0.7544146591633633, 0.7546049711495783, 0.7543937461883906, 0.7549922343021965, 0.7522593921192404, 0.7451732088785177, 0.7409469201436246, 0.7494536501701292, 0.7546770011431121, 0.7452551900706852, 0.7452551900706852, 0.7540901362914241, 0.7543918353689142, 0.7543341323373656, 0.7527687660812171, 0.7543341323373656, 0.7452120669891239, 0.7500980996692641, 0.7535315673165683, 0.7505888951205832, 0.713831478537361, 0.7527687660812171, 0.7519995525476817, 0.7452120669891239, 0.7134883984474601, 0.7530918972880041, 0.7546070159857904, 0.7551088405153266, 0.7551088405153266, 0.7550187421907539, 0.7558323832828185, 0.7550187421907539, 0.7558323832828185, 0.7544960035523979, 0.7546834176441157, 0.7547043944742474, 0.7547043944742474, 0.7546834176441157, 0.7546834176441157, 0.7547999332183204, 0.7547999332183204, 0.7542888919783124, 0.7542888919783124, 0.7542888919783124, 0.7524901229759056, 0.75535431539765, 0.7548845470692718, 0.7530335077368362, 0.7560372377379465, 0.7560372377379465, 0.7548290408525754, 0.7560372377379465, 0.7533642240781333, 0.7560372377379465, 0.755443234836703, 0.7235449735449735, 0.7536554178017457, 0.755443234836703, 0.755443234836703, 0.755443234836703, 0.7554084867359991, 0.755443234836703, 0.755443234836703, 0.7538958147818344, 0.7553626575411068, 0.7542691589826447, 0.7542691589826447, 0.7530682102802437, 0.7530682102802437, 0.755443234836703 ], "type": "scatter" }, { "mode": "lines", "name": "Best Value", "x": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105 ], "y": [ 0.7527412434448526, 0.7527412434448526, 0.7527412434448526, 0.7527412434448526, 0.7527412434448526, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7546770011431121, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7550077898953929, 0.7551088405153266, 0.7551088405153266, 0.7551088405153266, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7558323832828185, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465, 0.7560372377379465 ], "type": "scatter" }, { "marker": { "color": "#cccccc" }, "mode": "markers", "name": "Infeasible Trial", "showlegend": false, "x": [], "y": [], "type": "scatter" } ], "layout": { "title": { "text": "Optimization History Plot" }, "xaxis": { "title": { "text": "Trial" } }, "yaxis": { "title": { "text": "Objective Value" } }, "template": { "data": { "histogram2dcontour": [ { "type": "histogram2dcontour", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "choropleth": [ { "type": "choropleth", "colorbar": { "outlinewidth": 0, "ticks": "" } } ], "histogram2d": [ { "type": "histogram2d", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "heatmap": [ { "type": "heatmap", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "heatmapgl": [ { "type": "heatmapgl", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "contourcarpet": [ { "type": "contourcarpet", "colorbar": { "outlinewidth": 0, "ticks": "" } } ], "contour": [ { "type": "contour", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "surface": [ { "type": "surface", "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ] } ], "mesh3d": [ { "type": "mesh3d", "colorbar": { "outlinewidth": 0, "ticks": "" } } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "parcoords": [ { "type": "parcoords", "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatterpolargl": [ { "type": "scatterpolargl", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "scattergeo": [ { "type": "scattergeo", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatterpolar": [ { "type": "scatterpolar", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "scattergl": [ { "type": "scattergl", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatter3d": [ { "type": "scatter3d", "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scattermapbox": [ { "type": "scattermapbox", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scatterternary": [ { "type": "scatterternary", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "scattercarpet": [ { "type": "scattercarpet", "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } } } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "pie": [ { "automargin": true, "type": "pie" } ] }, "layout": { "autotypenumbers": "strict", "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "hovermode": "closest", "hoverlabel": { "align": "left" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "bgcolor": "#E5ECF6", "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "ternary": { "bgcolor": "#E5ECF6", "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "sequential": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "sequentialminus": [ [ 0.0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1.0, "#f0f921" ] ], "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ] }, "xaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "automargin": true, "zerolinewidth": 2 }, "yaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "automargin": true, "zerolinewidth": 2 }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2 }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2 }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white", "gridwidth": 2 } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "geo": { "bgcolor": "white", "landcolor": "#E5ECF6", "subunitcolor": "white", "showland": true, "showlakes": true, "lakecolor": "white" }, "title": { "x": 0.05 }, "mapbox": { "style": "light" } } } }, "config": { "plotlyServerURL": "https://plot.ly" } }, "text/html": [ "