-
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.
- Loading branch information
1 parent
5142956
commit 062597f
Showing
2 changed files
with
209 additions
and
22 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
121 changes: 121 additions & 0 deletions
121
prediction/short_term_outcome_prediction/explorations/xgb_gridsearch_evaluation.ipynb
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,121 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "initial_id", | ||
"metadata": { | ||
"ExecuteTime": { | ||
"end_time": "2024-08-23T10:34:57.630025Z", | ||
"start_time": "2024-08-23T10:34:57.627164Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import matplotlib.pyplot as plt\n", | ||
"import pandas as pd\n", | ||
"import os\n", | ||
"import seaborn as sns" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b7dfd825b243cf65", | ||
"metadata": { | ||
"ExecuteTime": { | ||
"end_time": "2024-08-23T10:35:30.472389Z", | ||
"start_time": "2024-08-23T10:35:30.468200Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"log_folder_path = '/Users/jk1/Downloads/xgb_gs'\n", | ||
"output_dir = '/Users/jk1/Downloads'" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5df24c93e6096cfd", | ||
"metadata": { | ||
"ExecuteTime": { | ||
"end_time": "2024-08-23T10:35:46.517467Z", | ||
"start_time": "2024-08-23T10:35:46.374150Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"gs_df = pd.DataFrame()\n", | ||
"for root, dirs, files in os.walk(log_folder_path):\n", | ||
" for file in files:\n", | ||
" if file.endswith('.jsonl'):\n", | ||
" temp_df = pd.read_json(os.path.join(root, file), \n", | ||
" lines=True, dtype={'timestamp': 'object'}, convert_dates=False).drop(0)\n", | ||
" # add file name as column\n", | ||
" temp_df['file_name'] = file\n", | ||
" gs_df = pd.concat([gs_df, temp_df], ignore_index=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ce6cba7b03680cb", | ||
"metadata": { | ||
"ExecuteTime": { | ||
"end_time": "2024-08-23T10:35:49.821820Z", | ||
"start_time": "2024-08-23T10:35:49.801767Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"gs_df" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b2e38efb0e502dd", | ||
"metadata": { | ||
"ExecuteTime": { | ||
"end_time": "2024-08-23T10:36:20.053438Z", | ||
"start_time": "2024-08-23T10:36:20.040408Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"best_df = gs_df.sort_values('median_val_scores', ascending=False).head(1)\n", | ||
"best_df" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "fba22c4b0b816d4c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |