{"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","execution":{"iopub.status.busy":"2022-08-22T06:28:11.596128Z","iopub.execute_input":"2022-08-22T06:28:11.597244Z","iopub.status.idle":"2022-08-22T06:28:11.609365Z","shell.execute_reply.started":"2022-08-22T06:28:11.597191Z","shell.execute_reply":"2022-08-22T06:28:11.608320Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install --pre pycaret","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:28:11.611216Z","iopub.execute_input":"2022-08-22T06:28:11.611866Z","iopub.status.idle":"2022-08-22T06:29:13.338274Z","shell.execute_reply.started":"2022-08-22T06:28:11.611829Z","shell.execute_reply":"2022-08-22T06:29:13.336768Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from pycaret.classification import *","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:13.340306Z","iopub.execute_input":"2022-08-22T06:29:13.340684Z","iopub.status.idle":"2022-08-22T06:29:18.272903Z","shell.execute_reply.started":"2022-08-22T06:29:13.340645Z","shell.execute_reply":"2022-08-22T06:29:18.271307Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install modin","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:18.275133Z","iopub.execute_input":"2022-08-22T06:29:18.275665Z","iopub.status.idle":"2022-08-22T06:29:32.513537Z","shell.execute_reply.started":"2022-08-22T06:29:18.275605Z","shell.execute_reply":"2022-08-22T06:29:32.511903Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:32.516952Z","iopub.execute_input":"2022-08-22T06:29:32.517401Z","iopub.status.idle":"2022-08-22T06:29:32.525500Z","shell.execute_reply.started":"2022-08-22T06:29:32.517359Z","shell.execute_reply":"2022-08-22T06:29:32.523039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=pd.read_csv('../input/amex-default-prediction/train_data.csv', nrows=20000)","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:32.527509Z","iopub.execute_input":"2022-08-22T06:29:32.527978Z","iopub.status.idle":"2022-08-22T06:29:33.274966Z","shell.execute_reply.started":"2022-08-22T06:29:32.527932Z","shell.execute_reply":"2022-08-22T06:29:33.273814Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df1=pd.read_csv('../input/amex-default-prediction/train_labels.csv',low_memory=True, nrows=20000)","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:33.276727Z","iopub.execute_input":"2022-08-22T06:29:33.277153Z","iopub.status.idle":"2022-08-22T06:29:33.307595Z","shell.execute_reply.started":"2022-08-22T06:29:33.277116Z","shell.execute_reply":"2022-08-22T06:29:33.306402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:33.309274Z","iopub.execute_input":"2022-08-22T06:29:33.309621Z","iopub.status.idle":"2022-08-22T06:29:33.343107Z","shell.execute_reply.started":"2022-08-22T06:29:33.309589Z","shell.execute_reply":"2022-08-22T06:29:33.342155Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"type(df)","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:33.344264Z","iopub.execute_input":"2022-08-22T06:29:33.345049Z","iopub.status.idle":"2022-08-22T06:29:33.351880Z","shell.execute_reply.started":"2022-08-22T06:29:33.345014Z","shell.execute_reply":"2022-08-22T06:29:33.350935Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df1.head()","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:33.353079Z","iopub.execute_input":"2022-08-22T06:29:33.353633Z","iopub.status.idle":"2022-08-22T06:29:33.369025Z","shell.execute_reply.started":"2022-08-22T06:29:33.353597Z","shell.execute_reply":"2022-08-22T06:29:33.367927Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=pd.merge(df,df1, on=['customer_ID'])","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:33.374396Z","iopub.execute_input":"2022-08-22T06:29:33.375199Z","iopub.status.idle":"2022-08-22T06:29:33.449197Z","shell.execute_reply.started":"2022-08-22T06:29:33.375146Z","shell.execute_reply":"2022-08-22T06:29:33.447963Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:33.450770Z","iopub.execute_input":"2022-08-22T06:29:33.451455Z","iopub.status.idle":"2022-08-22T06:29:33.477053Z","shell.execute_reply.started":"2022-08-22T06:29:33.451408Z","shell.execute_reply":"2022-08-22T06:29:33.475773Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_df=pd.read_csv('../input/amex-default-prediction/test_data.csv', nrows=10000)","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:33.479807Z","iopub.execute_input":"2022-08-22T06:29:33.481079Z","iopub.status.idle":"2022-08-22T06:29:33.831117Z","shell.execute_reply.started":"2022-08-22T06:29:33.481026Z","shell.execute_reply":"2022-08-22T06:29:33.829890Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sam_df=pd.read_csv('../input/amex-default-prediction/sample_submission.csv',low_memory=True, nrows=10000)","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:33.832553Z","iopub.execute_input":"2022-08-22T06:29:33.833066Z","iopub.status.idle":"2022-08-22T06:29:33.853058Z","shell.execute_reply.started":"2022-08-22T06:29:33.833029Z","shell.execute_reply":"2022-08-22T06:29:33.851971Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"s=setup(data=df.drop(['customer_ID', 'S_2'], axis=1),target='target')","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:33.854705Z","iopub.execute_input":"2022-08-22T06:29:33.855105Z","iopub.status.idle":"2022-08-22T06:29:42.025904Z","shell.execute_reply.started":"2022-08-22T06:29:33.855072Z","shell.execute_reply":"2022-08-22T06:29:42.024547Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"best=compare_models()","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:29:42.027529Z","iopub.execute_input":"2022-08-22T06:29:42.028192Z","iopub.status.idle":"2022-08-22T06:44:10.428793Z","shell.execute_reply.started":"2022-08-22T06:29:42.028150Z","shell.execute_reply":"2022-08-22T06:44:10.427549Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"evaluate_model(best)","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:44:10.430229Z","iopub.execute_input":"2022-08-22T06:44:10.430566Z","iopub.status.idle":"2022-08-22T06:44:11.123912Z","shell.execute_reply.started":"2022-08-22T06:44:10.430528Z","shell.execute_reply":"2022-08-22T06:44:11.122802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model=create_model('et')","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:44:11.125338Z","iopub.execute_input":"2022-08-22T06:44:11.125959Z","iopub.status.idle":"2022-08-22T06:44:27.258269Z","shell.execute_reply.started":"2022-08-22T06:44:11.125919Z","shell.execute_reply":"2022-08-22T06:44:27.256940Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pred=predict_model(model,data=test_df.drop(['customer_ID', 'S_2'], axis=1),raw_score=False)","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:44:27.259934Z","iopub.execute_input":"2022-08-22T06:44:27.260317Z","iopub.status.idle":"2022-08-22T06:44:28.936546Z","shell.execute_reply.started":"2022-08-22T06:44:27.260283Z","shell.execute_reply":"2022-08-22T06:44:28.935555Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pred","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:44:28.938007Z","iopub.execute_input":"2022-08-22T06:44:28.938337Z","iopub.status.idle":"2022-08-22T06:44:28.972456Z","shell.execute_reply.started":"2022-08-22T06:44:28.938305Z","shell.execute_reply":"2022-08-22T06:44:28.971173Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sam_df['prediction']=pred['Label']","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:44:28.974906Z","iopub.execute_input":"2022-08-22T06:44:28.975412Z","iopub.status.idle":"2022-08-22T06:44:28.981738Z","shell.execute_reply.started":"2022-08-22T06:44:28.975364Z","shell.execute_reply":"2022-08-22T06:44:28.980503Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sam_df","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:44:28.983536Z","iopub.execute_input":"2022-08-22T06:44:28.984104Z","iopub.status.idle":"2022-08-22T06:44:29.001521Z","shell.execute_reply.started":"2022-08-22T06:44:28.984059Z","shell.execute_reply":"2022-08-22T06:44:29.000462Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sam_df.to_csv('sample_submission.csv')","metadata":{"execution":{"iopub.status.busy":"2022-08-22T06:44:29.002678Z","iopub.execute_input":"2022-08-22T06:44:29.003076Z","iopub.status.idle":"2022-08-22T06:44:29.042201Z","shell.execute_reply.started":"2022-08-22T06:44:29.003039Z","shell.execute_reply":"2022-08-22T06:44:29.041150Z"},"trusted":true},"execution_count":null,"outputs":[]}]}