{"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-05-01T17:32:23.826965Z","iopub.execute_input":"2022-05-01T17:32:23.827260Z","iopub.status.idle":"2022-05-01T17:32:23.836441Z","shell.execute_reply.started":"2022-05-01T17:32:23.827211Z","shell.execute_reply":"2022-05-01T17:32:23.835676Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"PATH = '/kaggle/input/jigsaw-multilingual-toxic-comment-classification'\ntrain_path = 'jigsaw-toxic-comment-train.csv'\nvalidation_path = 'validation.csv'\ntest_path = 'test.csv'\n\ntrain = pd.read_csv(f'{PATH}/{train_path}')\nvalidation = pd.read_csv(f'{PATH}/{validation_path}')\ntest = pd.read_csv(f'{PATH}/{test_path}')","metadata":{"execution":{"iopub.status.busy":"2022-05-01T17:34:05.540334Z","iopub.execute_input":"2022-05-01T17:34:05.540614Z","iopub.status.idle":"2022-05-01T17:34:07.180163Z","shell.execute_reply.started":"2022-05-01T17:34:05.540585Z","shell.execute_reply":"2022-05-01T17:34:07.179459Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.drop(['severe_toxic','obscene','threat','insult','identity_hate'],axis=1,inplace=True)","metadata":{"execution":{"iopub.status.busy":"2022-05-01T17:32:27.079858Z","iopub.execute_input":"2022-05-01T17:32:27.080118Z","iopub.status.idle":"2022-05-01T17:32:27.111099Z","shell.execute_reply.started":"2022-05-01T17:32:27.080083Z","shell.execute_reply":"2022-05-01T17:32:27.110409Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = train.loc[:12000,:]\ntrain.shape","metadata":{"execution":{"iopub.status.busy":"2022-05-01T17:32:27.113117Z","iopub.execute_input":"2022-05-01T17:32:27.113490Z","iopub.status.idle":"2022-05-01T17:32:27.121535Z","shell.execute_reply.started":"2022-05-01T17:32:27.113456Z","shell.execute_reply":"2022-05-01T17:32:27.120775Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.head()","metadata":{"execution":{"iopub.status.busy":"2022-05-01T17:32:27.122965Z","iopub.execute_input":"2022-05-01T17:32:27.123306Z","iopub.status.idle":"2022-05-01T17:32:27.140780Z","shell.execute_reply.started":"2022-05-01T17:32:27.123267Z","shell.execute_reply":"2022-05-01T17:32:27.140132Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train['comment_text'].apply(lambda x:len(str(x).split())).max()","metadata":{"execution":{"iopub.status.busy":"2022-05-01T17:32:27.142555Z","iopub.execute_input":"2022-05-01T17:32:27.142814Z","iopub.status.idle":"2022-05-01T17:32:27.208622Z","shell.execute_reply.started":"2022-05-01T17:32:27.142782Z","shell.execute_reply":"2022-05-01T17:32:27.207929Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test","metadata":{"execution":{"iopub.status.busy":"2022-05-01T17:32:36.978864Z","iopub.execute_input":"2022-05-01T17:32:36.979114Z","iopub.status.idle":"2022-05-01T17:32:36.993492Z","shell.execute_reply.started":"2022-05-01T17:32:36.979087Z","shell.execute_reply":"2022-05-01T17:32:36.992540Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"code","source":"sample = pd.read_csv('/kaggle/input/jigsaw-multilingual-toxic-comment-classification/sample_submission.csv')\nsample","metadata":{"execution":{"iopub.status.busy":"2022-05-01T17:33:19.791805Z","iopub.execute_input":"2022-05-01T17:33:19.792074Z","iopub.status.idle":"2022-05-01T17:33:19.841762Z","shell.execute_reply.started":"2022-05-01T17:33:19.792047Z","shell.execute_reply":"2022-05-01T17:33:19.841018Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test = pd.read_csv(f'{PATH}/{test_path}')\ntest","metadata":{"execution":{"iopub.status.busy":"2022-05-01T17:35:36.720666Z","iopub.execute_input":"2022-05-01T17:35:36.721108Z","iopub.status.idle":"2022-05-01T17:35:37.158132Z","shell.execute_reply.started":"2022-05-01T17:35:36.721073Z","shell.execute_reply":"2022-05-01T17:35:37.157476Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test['toxic']= 0\ntest.drop(['content', 'lang'],axis=1,inplace=True)\ntest","metadata":{"execution":{"iopub.status.busy":"2022-05-01T17:35:39.865574Z","iopub.execute_input":"2022-05-01T17:35:39.866126Z","iopub.status.idle":"2022-05-01T17:35:39.888409Z","shell.execute_reply.started":"2022-05-01T17:35:39.866087Z","shell.execute_reply":"2022-05-01T17:35:39.887480Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-05-01T17:37:01.042990Z","iopub.execute_input":"2022-05-01T17:37:01.043457Z","iopub.status.idle":"2022-05-01T17:37:01.135818Z","shell.execute_reply.started":"2022-05-01T17:37:01.043422Z","shell.execute_reply":"2022-05-01T17:37:01.135108Z"},"trusted":true},"execution_count":null,"outputs":[]}]}