{"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":"!pip3 install -U pip -q\n!pip3 install -U setuptools wheel -q\n!pip3 install autogluon -q","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-07-29T18:24:48.429998Z","iopub.execute_input":"2022-07-29T18:24:48.430803Z","iopub.status.idle":"2022-07-29T18:26:41.811386Z","shell.execute_reply.started":"2022-07-29T18:24:48.430702Z","shell.execute_reply":"2022-07-29T18:26:41.810173Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from autogluon.tabular import TabularDataset, TabularPredictor","metadata":{"execution":{"iopub.status.busy":"2022-07-29T18:26:41.813437Z","iopub.execute_input":"2022-07-29T18:26:41.813810Z","iopub.status.idle":"2022-07-29T18:26:43.089243Z","shell.execute_reply.started":"2022-07-29T18:26:41.813776Z","shell.execute_reply":"2022-07-29T18:26:43.088074Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\ndf=pd.read_csv('../input/predict-potential-spammers-on-fiverr/train.csv')\ndf.label.value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-29T19:08:50.315806Z","iopub.execute_input":"2022-07-29T19:08:50.316738Z","iopub.status.idle":"2022-07-29T19:08:52.124252Z","shell.execute_reply.started":"2022-07-29T19:08:50.316699Z","shell.execute_reply":"2022-07-29T19:08:52.122821Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data = TabularDataset('../input/predict-potential-spammers-on-fiverr/train.csv')\ntrain_data=train_data.drop(columns=['user_id'])\ntrain_data.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-29T18:26:46.139997Z","iopub.execute_input":"2022-07-29T18:26:46.141167Z","iopub.status.idle":"2022-07-29T18:26:49.847354Z","shell.execute_reply.started":"2022-07-29T18:26:46.141115Z","shell.execute_reply":"2022-07-29T18:26:49.845801Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"save_path = 'agModels-predictClass'  # specifies folder to store trained models\npredictor = TabularPredictor(label='label',eval_metric='f1_macro', path=save_path).fit(train_data)","metadata":{"execution":{"iopub.status.busy":"2022-07-29T18:26:49.848808Z","iopub.execute_input":"2022-07-29T18:26:49.849644Z","iopub.status.idle":"2022-07-29T19:03:43.340889Z","shell.execute_reply.started":"2022-07-29T18:26:49.849603Z","shell.execute_reply":"2022-07-29T19:03:43.339652Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_data = TabularDataset('../input/predict-potential-spammers-on-fiverr/test.csv')\ntest_data=test_data.drop(columns=['user_id'])\ntest_data.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-29T19:03:43.342643Z","iopub.execute_input":"2022-07-29T19:03:43.343397Z","iopub.status.idle":"2022-07-29T19:03:43.524950Z","shell.execute_reply.started":"2022-07-29T19:03:43.343357Z","shell.execute_reply":"2022-07-29T19:03:43.523849Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds=predictor.predict(test_data)\n","metadata":{"execution":{"iopub.status.busy":"2022-07-29T19:08:13.968525Z","iopub.execute_input":"2022-07-29T19:08:13.969824Z","iopub.status.idle":"2022-07-29T19:08:15.857456Z","shell.execute_reply.started":"2022-07-29T19:08:13.969765Z","shell.execute_reply":"2022-07-29T19:08:15.855845Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds.value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-29T19:08:26.800449Z","iopub.execute_input":"2022-07-29T19:08:26.801098Z","iopub.status.idle":"2022-07-29T19:08:26.812020Z","shell.execute_reply.started":"2022-07-29T19:08:26.801042Z","shell.execute_reply":"2022-07-29T19:08:26.810946Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission=pd.read_csv('../input/predict-potential-spammers-on-fiverr/sample_submission.csv')\nsubmission.head()\n","metadata":{"execution":{"iopub.status.busy":"2022-07-29T19:48:32.425342Z","iopub.execute_input":"2022-07-29T19:48:32.425862Z","iopub.status.idle":"2022-07-29T19:48:32.463781Z","shell.execute_reply.started":"2022-07-29T19:48:32.425821Z","shell.execute_reply":"2022-07-29T19:48:32.462492Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.label=preds","metadata":{"execution":{"iopub.status.busy":"2022-07-29T19:12:35.226049Z","iopub.execute_input":"2022-07-29T19:12:35.226842Z","iopub.status.idle":"2022-07-29T19:12:35.233743Z","shell.execute_reply.started":"2022-07-29T19:12:35.226799Z","shell.execute_reply":"2022-07-29T19:12:35.232279Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.columns=['user_id','prediction']","metadata":{"execution":{"iopub.status.busy":"2022-07-29T19:49:06.139517Z","iopub.execute_input":"2022-07-29T19:49:06.140783Z","iopub.status.idle":"2022-07-29T19:49:06.147436Z","shell.execute_reply.started":"2022-07-29T19:49:06.140707Z","shell.execute_reply":"2022-07-29T19:49:06.146162Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.to_csv('submission.csv', index=False)\n","metadata":{"execution":{"iopub.status.busy":"2022-07-29T19:12:45.291694Z","iopub.execute_input":"2022-07-29T19:12:45.292229Z","iopub.status.idle":"2022-07-29T19:12:45.347148Z","shell.execute_reply.started":"2022-07-29T19:12:45.292189Z","shell.execute_reply":"2022-07-29T19:12:45.345929Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}