hipom_data_mapping/post_process/tfidf_class/2y.conbine_classifcation.ipynb

58 lines
1.5 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import os\n",
"group_number = 5\n",
"class_model = 'distilbert'\n",
"gen_model = 't5-tiny'\n",
"# 경로 설정\n",
"test_path = f'../../translation/0.result/{group_number}/test_p.csv'\n",
"class_path = f'0.class_document/{class_model}/{group_number}/test_p_c.csv'\n",
"output_path = f'0.class_document/{class_model}/{gen_model}/{group_number}/test_p_c.csv'\n",
"\n",
"# 파일 읽기\n",
"test_df = pd.read_csv(test_path)\n",
"class_df = pd.read_csv(class_path)\n",
"\n",
"# 필요한 필드 선택\n",
"fields_to_copy = ['c_thing', 'c_property', 'c_score', 'cthing_correct', 'cproperty_correct', 'ctp_correct']\n",
"class_df_subset = class_df[fields_to_copy]\n",
"\n",
"# test_path에 필드 복사\n",
"merged_df = pd.concat([test_df, class_df_subset], axis=1)\n",
"\n",
"# 결과 저장\n",
"os.makedirs(os.path.dirname(output_path), exist_ok=True)\n",
"merged_df.to_csv(output_path, index=False)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "torch",
"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.10.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}