Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnight9507 committed Jun 19, 2021
1 parent 1327306 commit 8ce06a9
Show file tree
Hide file tree
Showing 22 changed files with 4,993 additions and 4,192 deletions.
68 changes: 68 additions & 0 deletions code/Ensemble/power_ensemble.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "343ee127-66d1-48cd-a207-3f5ddba915cc",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['/opt/ml/code/output/pjh_0.7312_0.7911.csv', '/opt/ml/code/output/output6_19_17_30.csv', '/opt/ml/code/output/hk_auc8285_acc7554.csv', '/opt/ml/code/output/output_7975.csv']\n"
]
}
],
"source": [
"# 평균\n",
"from glob import glob\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"plt.style.use('fivethirtyeight')\n",
"\n",
"%matplotlib inline\n",
"\n",
"output_path = \"/opt/ml/code/output/cross_validation/output.csv\"\n",
"csv_file_path_list = glob(\"/opt/ml/code/output/*.csv\")\n",
"print(csv_file_path_list)\n",
"\n",
"POWER = 1/4\n",
"\n",
"# concat result dataframe\n",
"result = pd.read_csv(csv_file_path_list[0])[\"prediction\"]\n",
"result = result ** POWER\n",
"for csv_file_path in csv_file_path_list[1:]:\n",
" temp_result = pd.read_csv(csv_file_path)[\"prediction\"]\n",
" temp_result = temp_result ** POWER\n",
" result = pd.concat([result, temp_result], axis=1)\n",
"\n",
"# mean result dataframe\n",
"result = pd.DataFrame(result.mean(axis=1)).reset_index().rename(columns = {0:\"prediction\", \"index\":\"id\"})\n",
"result.to_csv(output_path, index=False)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
2,116 changes: 2,116 additions & 0 deletions code/Ensemble/stacking.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 8ce06a9

Please sign in to comment.