{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-output":true,"scrolled":true,"execution":{"iopub.status.busy":"2022-06-03T19:17:31.809107Z","iopub.execute_input":"2022-06-03T19:17:31.809711Z","iopub.status.idle":"2022-06-03T19:17:31.938893Z","shell.execute_reply.started":"2022-06-03T19:17:31.809596Z","shell.execute_reply":"2022-06-03T19:17:31.937838Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df = pd.read_pickle('../input/amex-data-pckl-files/test_agg.pkl', compression='gzip')","metadata":{"execution":{"iopub.status.busy":"2022-06-03T19:26:54.13383Z","iopub.execute_input":"2022-06-03T19:26:54.134773Z","iopub.status.idle":"2022-06-03T19:27:10.598111Z","shell.execute_reply.started":"2022-06-03T19:26:54.134704Z","shell.execute_reply":"2022-06-03T19:27:10.597016Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install autogluon","metadata":{"_kg_hide-output":true,"scrolled":true,"execution":{"iopub.status.busy":"2022-06-03T19:17:54.743254Z","iopub.execute_input":"2022-06-03T19:17:54.743609Z","iopub.status.idle":"2022-06-03T19:18:09.447012Z","shell.execute_reply.started":"2022-06-03T19:17:54.743577Z","shell.execute_reply":"2022-06-03T19:18:09.445808Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from autogluon.tabular import TabularDataset, TabularPredictor","metadata":{"execution":{"iopub.status.busy":"2022-06-03T19:18:09.449497Z","iopub.execute_input":"2022-06-03T19:18:09.449836Z","iopub.status.idle":"2022-06-03T19:18:11.611077Z","shell.execute_reply.started":"2022-06-03T19:18:09.449802Z","shell.execute_reply":"2022-06-03T19:18:11.609871Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictor = TabularPredictor.load('../input/notebook832ca68bb9/agModels-predictClass/')","metadata":{"execution":{"iopub.status.busy":"2022-06-03T19:18:11.612373Z","iopub.execute_input":"2022-06-03T19:18:11.612799Z","iopub.status.idle":"2022-06-03T19:18:11.643687Z","shell.execute_reply.started":"2022-06-03T19:18:11.612762Z","shell.execute_reply":"2022-06-03T19:18:11.642875Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictor.leaderboard()","metadata":{"execution":{"iopub.status.busy":"2022-06-03T19:18:11.645188Z","iopub.execute_input":"2022-06-03T19:18:11.646033Z","iopub.status.idle":"2022-06-03T19:18:11.692774Z","shell.execute_reply.started":"2022-06-03T19:18:11.645991Z","shell.execute_reply":"2022-06-03T19:18:11.691621Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred = []\ntest_df = test_df.drop('customer_ID', axis=1)\nfor i in range(0, test_df.shape[0], 100000):\n    y_pred.extend(predictor.predict_proba(test_df.iloc[i:i+100000])[1].to_list())","metadata":{"execution":{"iopub.status.busy":"2022-06-03T19:27:10.599995Z","iopub.execute_input":"2022-06-03T19:27:10.600369Z","iopub.status.idle":"2022-06-03T19:37:55.06096Z","shell.execute_reply.started":"2022-06-03T19:27:10.600333Z","shell.execute_reply":"2022-06-03T19:37:55.059646Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub_df = pd.read_csv('../input/amex-default-prediction/sample_submission.csv')","metadata":{"execution":{"iopub.status.busy":"2022-06-03T19:38:37.656094Z","iopub.execute_input":"2022-06-03T19:38:37.656977Z","iopub.status.idle":"2022-06-03T19:38:39.569311Z","shell.execute_reply.started":"2022-06-03T19:38:37.656939Z","shell.execute_reply":"2022-06-03T19:38:39.568345Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub_df['prediction'] = y_pred","metadata":{"execution":{"iopub.status.busy":"2022-06-03T19:38:53.602382Z","iopub.execute_input":"2022-06-03T19:38:53.602897Z","iopub.status.idle":"2022-06-03T19:38:53.7563Z","shell.execute_reply.started":"2022-06-03T19:38:53.602857Z","shell.execute_reply":"2022-06-03T19:38:53.755288Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub_df.to_csv('sumbmission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-06-03T19:39:24.061029Z","iopub.execute_input":"2022-06-03T19:39:24.061634Z","iopub.status.idle":"2022-06-03T19:39:29.635512Z","shell.execute_reply.started":"2022-06-03T19:39:24.061583Z","shell.execute_reply":"2022-06-03T19:39:29.634698Z"},"trusted":true},"execution_count":null,"outputs":[]}]}