generated from bokulich-lab/q2-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2nd committee meeting setup + best hyperparams range
- Loading branch information
1 parent
9ab31be
commit b605fea
Showing
3 changed files
with
139 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Import experiments from former MLflow UI\n", | ||
"\n", | ||
"\n", | ||
"this is a workaround if mlflow does not react with too many experiments on Euler" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import mlflow\n", | ||
"import pandas as pd\n", | ||
"\n", | ||
"# Read the CSV file\n", | ||
"df = pd.read_csv(\"models/intermediate_rtrac5c_r0r3_le2y_cpu_t10.csv\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# df.columns.tolist()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"experiment_name = \"euler_imported3\"\n", | ||
"mlflow.create_experiment(experiment_name)\n", | ||
"\n", | ||
"# Get the experiment ID\n", | ||
"experiment = mlflow.get_experiment_by_name(experiment_name)\n", | ||
"experiment_id = experiment.experiment_id\n", | ||
"\n", | ||
"# Define the custom order for the models\n", | ||
"model_order = {\n", | ||
" \"linreg\": 1,\n", | ||
" \"trac\": 2,\n", | ||
" \"xgb\": 3,\n", | ||
" \"nn_reg\": 4,\n", | ||
" \"nn_class\": 5,\n", | ||
" \"nn_corn\": 6,\n", | ||
" \"rf\": 7,\n", | ||
"}\n", | ||
"\n", | ||
"# Iterate over the rows of the DataFrame and log each run\n", | ||
"for _, row in df.iterrows():\n", | ||
" with mlflow.start_run(experiment_id=experiment_id):\n", | ||
" # Log the metrics, parameters, and tags from the CSV\n", | ||
" for key, value in row.items():\n", | ||
" if key.startswith(\"metrics.\"):\n", | ||
" metric_name = key.split(\".\", 1)[1]\n", | ||
" mlflow.log_metric(metric_name, value)\n", | ||
" elif key.startswith(\"params.\"):\n", | ||
" param_name = key.split(\".\", 1)[1]\n", | ||
" mlflow.log_param(param_name, value)\n", | ||
" elif key == \"model\":\n", | ||
" mlflow.log_param(\"model\", value)\n", | ||
" # Log the model order as a separate parameter\n", | ||
" mlflow.log_param(\"model_order\", model_order.get(value, 999))\n", | ||
" elif key == \"time_total_s\":\n", | ||
" mlflow.log_metric(\"time_total_s\", value)\n", | ||
" elif key.startswith(\"tags.\"):\n", | ||
" tag_name = key.split(\".\", 1)[1]\n", | ||
" mlflow.set_tag(tag_name, value)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"[2024-05-05 13:41:53 +0200] [35348] [INFO] Starting gunicorn 21.2.0\n", | ||
"[2024-05-05 13:41:53 +0200] [35348] [INFO] Listening at: http://127.0.0.1:5004 (35348)\n", | ||
"[2024-05-05 13:41:53 +0200] [35348] [INFO] Using worker: sync\n", | ||
"[2024-05-05 13:41:53 +0200] [35350] [INFO] Booting worker with pid: 35350\n", | ||
"[2024-05-05 13:41:53 +0200] [35352] [INFO] Booting worker with pid: 35352\n", | ||
"[2024-05-05 13:41:53 +0200] [35353] [INFO] Booting worker with pid: 35353\n", | ||
"[2024-05-05 13:41:53 +0200] [35354] [INFO] Booting worker with pid: 35354\n", | ||
"^C\n", | ||
"[2024-05-05 13:44:47 +0200] [35348] [INFO] Handling signal: int\n", | ||
"[2024-05-05 13:44:47 +0200] [35352] [INFO] Worker exiting (pid: 35352)\n", | ||
"[2024-05-05 13:44:47 +0200] [35350] [INFO] Worker exiting (pid: 35350)\n", | ||
"[2024-05-05 13:44:47 +0200] [35354] [INFO] Worker exiting (pid: 35354)\n", | ||
"[2024-05-05 13:44:47 +0200] [35353] [INFO] Worker exiting (pid: 35353)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"! mlflow ui --port 5004" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "ritme_wclasso_f", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.0" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters