{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":74571,"databundleVersionId":8671431,"sourceType":"competition"}],"dockerImageVersionId":30673,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-05-27T08:38:09.220004Z","iopub.execute_input":"2024-05-27T08:38:09.220398Z","iopub.status.idle":"2024-05-27T08:38:09.225377Z","shell.execute_reply.started":"2024-05-27T08:38:09.220368Z","shell.execute_reply":"2024-05-27T08:38:09.224100Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv(\"/kaggle/input/affel-ds2-credit-card/train.csv\")\ntest = pd.read_csv(\"/kaggle/input/affel-ds2-credit-card/test.csv\")","metadata":{"execution":{"iopub.status.busy":"2024-05-27T08:38:09.227549Z","iopub.execute_input":"2024-05-27T08:38:09.227913Z","iopub.status.idle":"2024-05-27T08:38:11.401073Z","shell.execute_reply.started":"2024-05-27T08:38:09.227886Z","shell.execute_reply":"2024-05-27T08:38:11.399945Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.info()","metadata":{"execution":{"iopub.status.busy":"2024-05-27T08:38:11.402558Z","iopub.execute_input":"2024-05-27T08:38:11.403308Z","iopub.status.idle":"2024-05-27T08:38:11.425298Z","shell.execute_reply.started":"2024-05-27T08:38:11.403272Z","shell.execute_reply":"2024-05-27T08:38:11.424199Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.head(3)","metadata":{"execution":{"iopub.status.busy":"2024-05-27T08:38:11.426555Z","iopub.execute_input":"2024-05-27T08:38:11.426847Z","iopub.status.idle":"2024-05-27T08:38:11.451300Z","shell.execute_reply.started":"2024-05-27T08:38:11.426822Z","shell.execute_reply":"2024-05-27T08:38:11.450079Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\nfrom sklearn.ensemble import RandomForestClassifier\n\n\n# 입력 특성과 타겟 변수 분리\nX_train = train.drop(['id', 'Class'], axis=1)\ny_train = train['Class']\n\nX_test = test.drop(['id'], axis=1)\n\n# 로지스틱 회귀 모델 학습\nmodel = RandomForestClassifier()\nmodel.fit(X_train, y_train)\n\n# 테스트 데이터에 대한 예측\ny_pred = model.predict(X_test)\n\n# 제출 파일 생성\nsubmission = pd.DataFrame({'id': test['id'], 'Class': y_pred})\nsubmission.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2024-05-27T08:38:11.454206Z","iopub.execute_input":"2024-05-27T08:38:11.454746Z","iopub.status.idle":"2024-05-27T08:40:51.341706Z","shell.execute_reply.started":"2024-05-27T08:38:11.454706Z","shell.execute_reply":"2024-05-27T08:40:51.340505Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission","metadata":{"execution":{"iopub.status.busy":"2024-05-27T08:40:51.343576Z","iopub.execute_input":"2024-05-27T08:40:51.343996Z","iopub.status.idle":"2024-05-27T08:40:51.355061Z","shell.execute_reply.started":"2024-05-27T08:40:51.343939Z","shell.execute_reply":"2024-05-27T08:40:51.353923Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}