{"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":"markdown","source":"## Data Analysis","metadata":{}},{"cell_type":"code","source":"import pandas as pd","metadata":{"collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2023-02-17T12:38:34.851588Z","iopub.execute_input":"2023-02-17T12:38:34.852702Z","iopub.status.idle":"2023-02-17T12:38:34.881238Z","shell.execute_reply.started":"2023-02-17T12:38:34.852580Z","shell.execute_reply":"2023-02-17T12:38:34.880119Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = '/kaggle/input/quora-insincere-questions-classification/train.csv'\ntest = '/kaggle/input/quora-insincere-questions-classification/test.csv'\nsample_sub = '/kaggle/input/quora-insincere-questions-classification/sample_submission.csv'","metadata":{"collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2023-02-17T08:06:32.425041Z","iopub.execute_input":"2023-02-17T08:06:32.425887Z","iopub.status.idle":"2023-02-17T08:06:32.431805Z","shell.execute_reply.started":"2023-02-17T08:06:32.425834Z","shell.execute_reply":"2023-02-17T08:06:32.430966Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(train)\ntest_df = pd.read_csv(test)","metadata":{"collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2023-02-17T08:06:32.719328Z","iopub.execute_input":"2023-02-17T08:06:32.720071Z","iopub.status.idle":"2023-02-17T08:06:39.242511Z","shell.execute_reply.started":"2023-02-17T08:06:32.720021Z","shell.execute_reply":"2023-02-17T08:06:39.240867Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sincere_df = df[df.target == 0]\ninsincere_df = df[df.target == 1]","metadata":{"collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2023-02-17T08:06:39.244766Z","iopub.execute_input":"2023-02-17T08:06:39.245176Z","iopub.status.idle":"2023-02-17T08:06:39.369560Z","shell.execute_reply.started":"2023-02-17T08:06:39.245115Z","shell.execute_reply":"2023-02-17T08:06:39.368194Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(insincere_df),len(sincere_df)","metadata":{"collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2023-02-17T08:06:39.372736Z","iopub.execute_input":"2023-02-17T08:06:39.373646Z","iopub.status.idle":"2023-02-17T08:06:39.385444Z","shell.execute_reply.started":"2023-02-17T08:06:39.373596Z","shell.execute_reply":"2023-02-17T08:06:39.384217Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sincere_df.question_text[:10]","metadata":{"collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2023-02-17T08:06:39.388551Z","iopub.execute_input":"2023-02-17T08:06:39.389928Z","iopub.status.idle":"2023-02-17T08:06:39.401785Z","shell.execute_reply.started":"2023-02-17T08:06:39.389849Z","shell.execute_reply":"2023-02-17T08:06:39.400354Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"insincere_df.question_text[:10]","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:39.403094Z","iopub.execute_input":"2023-02-17T08:06:39.404007Z","iopub.status.idle":"2023-02-17T08:06:39.418841Z","shell.execute_reply.started":"2023-02-17T08:06:39.403971Z","shell.execute_reply":"2023-02-17T08:06:39.417543Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.target.value_counts(normalize=True)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:39.421032Z","iopub.execute_input":"2023-02-17T08:06:39.421632Z","iopub.status.idle":"2023-02-17T08:06:39.448214Z","shell.execute_reply.started":"2023-02-17T08:06:39.421586Z","shell.execute_reply":"2023-02-17T08:06:39.446449Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Data Preprocessing","metadata":{}},{"cell_type":"code","source":"from nltk.tokenize import word_tokenize\nfrom nltk.corpus import stopwords\nfrom nltk.stem import WordNetLemmatizer\nfrom nltk.stem import PorterStemmer","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:39.450048Z","iopub.execute_input":"2023-02-17T08:06:39.450440Z","iopub.status.idle":"2023-02-17T08:06:40.571512Z","shell.execute_reply.started":"2023-02-17T08:06:39.450408Z","shell.execute_reply":"2023-02-17T08:06:40.570583Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Tokenization","metadata":{}},{"cell_type":"code","source":"test_q = insincere_df.question_text.values[111]","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:54.680043Z","iopub.execute_input":"2023-02-17T08:06:54.680708Z","iopub.status.idle":"2023-02-17T08:06:54.686269Z","shell.execute_reply.started":"2023-02-17T08:06:54.680663Z","shell.execute_reply":"2023-02-17T08:06:54.685009Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tokenized_text = word_tokenize(test_q)\ntokenized_text","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:55.000671Z","iopub.execute_input":"2023-02-17T08:06:55.001585Z","iopub.status.idle":"2023-02-17T08:06:55.024233Z","shell.execute_reply.started":"2023-02-17T08:06:55.001519Z","shell.execute_reply":"2023-02-17T08:06:55.023133Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Stopwords","metadata":{}},{"cell_type":"code","source":"stopwords = stopwords.words('english')\n', '.join(stopwords)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:55.862427Z","iopub.execute_input":"2023-02-17T08:06:55.862811Z","iopub.status.idle":"2023-02-17T08:06:55.876414Z","shell.execute_reply.started":"2023-02-17T08:06:55.862781Z","shell.execute_reply":"2023-02-17T08:06:55.875000Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def remove_stopwords(text):\n    return [word for word in text if word.lower() not in stopwords]","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:56.126159Z","iopub.execute_input":"2023-02-17T08:06:56.126598Z","iopub.status.idle":"2023-02-17T08:06:56.132387Z","shell.execute_reply.started":"2023-02-17T08:06:56.126561Z","shell.execute_reply":"2023-02-17T08:06:56.130846Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"refined_text = remove_stopwords(tokenized_text)\nrefined_text","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:56.358362Z","iopub.execute_input":"2023-02-17T08:06:56.359692Z","iopub.status.idle":"2023-02-17T08:06:56.369015Z","shell.execute_reply.started":"2023-02-17T08:06:56.359633Z","shell.execute_reply":"2023-02-17T08:06:56.367744Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Lemmatization","metadata":{}},{"cell_type":"code","source":"lemmatizer = WordNetLemmatizer()\nstemmer = PorterStemmer()","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:57.079328Z","iopub.execute_input":"2023-02-17T08:06:57.079989Z","iopub.status.idle":"2023-02-17T08:06:57.085980Z","shell.execute_reply.started":"2023-02-17T08:06:57.079944Z","shell.execute_reply":"2023-02-17T08:06:57.084584Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def lemmatization(text):\n    return [lemmatizer.lemmatize(word) for word in text]","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:57.270958Z","iopub.execute_input":"2023-02-17T08:06:57.271651Z","iopub.status.idle":"2023-02-17T08:06:57.278310Z","shell.execute_reply.started":"2023-02-17T08:06:57.271614Z","shell.execute_reply":"2023-02-17T08:06:57.276845Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"lemmatization(refined_text)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:57.510003Z","iopub.execute_input":"2023-02-17T08:06:57.510464Z","iopub.status.idle":"2023-02-17T08:06:59.582986Z","shell.execute_reply.started":"2023-02-17T08:06:57.510430Z","shell.execute_reply":"2023-02-17T08:06:59.581658Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Bag Of Words","metadata":{}},{"cell_type":"code","source":"from sklearn.feature_extraction.text import CountVectorizer","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:59.585259Z","iopub.execute_input":"2023-02-17T08:06:59.585602Z","iopub.status.idle":"2023-02-17T08:06:59.590216Z","shell.execute_reply.started":"2023-02-17T08:06:59.585570Z","shell.execute_reply":"2023-02-17T08:06:59.588995Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"small_df = df[:5]","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:59.591715Z","iopub.execute_input":"2023-02-17T08:06:59.592042Z","iopub.status.idle":"2023-02-17T08:06:59.603326Z","shell.execute_reply.started":"2023-02-17T08:06:59.592011Z","shell.execute_reply":"2023-02-17T08:06:59.602381Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"small_df.question_text","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:06:59.606072Z","iopub.execute_input":"2023-02-17T08:06:59.607230Z","iopub.status.idle":"2023-02-17T08:06:59.621291Z","shell.execute_reply.started":"2023-02-17T08:06:59.607178Z","shell.execute_reply":"2023-02-17T08:06:59.620040Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Vocabulary","metadata":{}},{"cell_type":"code","source":"small_vect = CountVectorizer()\nsmall_vect.fit(small_df.question_text)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:07:00.699201Z","iopub.execute_input":"2023-02-17T08:07:00.699598Z","iopub.status.idle":"2023-02-17T08:07:00.717204Z","shell.execute_reply.started":"2023-02-17T08:07:00.699567Z","shell.execute_reply":"2023-02-17T08:07:00.716029Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"', '.join(small_vect.vocabulary_)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:07:01.127406Z","iopub.execute_input":"2023-02-17T08:07:01.128366Z","iopub.status.idle":"2023-02-17T08:07:01.135532Z","shell.execute_reply.started":"2023-02-17T08:07:01.128321Z","shell.execute_reply":"2023-02-17T08:07:01.134426Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Vectorization","metadata":{}},{"cell_type":"code","source":"small_vectors = small_vect.transform(small_df.question_text)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:07:01.964611Z","iopub.execute_input":"2023-02-17T08:07:01.965048Z","iopub.status.idle":"2023-02-17T08:07:01.971000Z","shell.execute_reply.started":"2023-02-17T08:07:01.965011Z","shell.execute_reply":"2023-02-17T08:07:01.969729Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"small_vectors.toarray()","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:07:02.250720Z","iopub.execute_input":"2023-02-17T08:07:02.251124Z","iopub.status.idle":"2023-02-17T08:07:02.259257Z","shell.execute_reply.started":"2023-02-17T08:07:02.251094Z","shell.execute_reply":"2023-02-17T08:07:02.257955Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Large Scale Implementation","metadata":{}},{"cell_type":"code","source":"def preprocess(text):\n    return [stemmer.stem(lemmatizer.lemmatize(word.lower())) for word in word_tokenize(text) if word.lower() not in stopwords]","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:07:03.122098Z","iopub.execute_input":"2023-02-17T08:07:03.123379Z","iopub.status.idle":"2023-02-17T08:07:03.129361Z","shell.execute_reply.started":"2023-02-17T08:07:03.123313Z","shell.execute_reply":"2023-02-17T08:07:03.128185Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"vectorizer = CountVectorizer(lowercase=True, tokenizer=preprocess, max_features=50000)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:07:06.443951Z","iopub.execute_input":"2023-02-17T08:07:06.444340Z","iopub.status.idle":"2023-02-17T08:07:06.449636Z","shell.execute_reply.started":"2023-02-17T08:07:06.444309Z","shell.execute_reply":"2023-02-17T08:07:06.448239Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\nvectorizer.fit(df.question_text)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:07:06.977400Z","iopub.execute_input":"2023-02-17T08:07:06.977803Z","iopub.status.idle":"2023-02-17T08:07:52.805770Z","shell.execute_reply.started":"2023-02-17T08:07:06.977770Z","shell.execute_reply":"2023-02-17T08:07:52.804409Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(vectorizer.vocabulary_)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:07:52.808554Z","iopub.execute_input":"2023-02-17T08:07:52.809482Z","iopub.status.idle":"2023-02-17T08:07:52.817307Z","shell.execute_reply.started":"2023-02-17T08:07:52.809414Z","shell.execute_reply":"2023-02-17T08:07:52.816018Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ninputs = vectorizer.transform(df.question_text)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:07:52.819073Z","iopub.execute_input":"2023-02-17T08:07:52.820003Z","iopub.status.idle":"2023-02-17T08:08:38.675033Z","shell.execute_reply.started":"2023-02-17T08:07:52.819950Z","shell.execute_reply":"2023-02-17T08:08:38.673547Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"inputs[0].toarray()","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:08:38.677765Z","iopub.execute_input":"2023-02-17T08:08:38.678114Z","iopub.status.idle":"2023-02-17T08:08:38.685790Z","shell.execute_reply.started":"2023-02-17T08:08:38.678084Z","shell.execute_reply":"2023-02-17T08:08:38.684639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ntest_inputs = vectorizer.transform(test_df.question_text)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:08:38.687376Z","iopub.execute_input":"2023-02-17T08:08:38.688330Z","iopub.status.idle":"2023-02-17T08:11:30.268223Z","shell.execute_reply.started":"2023-02-17T08:08:38.688294Z","shell.execute_reply":"2023-02-17T08:11:30.267018Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_inputs[0].toarray()","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:30.269519Z","iopub.execute_input":"2023-02-17T08:11:30.269932Z","iopub.status.idle":"2023-02-17T08:11:30.278824Z","shell.execute_reply.started":"2023-02-17T08:11:30.269900Z","shell.execute_reply":"2023-02-17T08:11:30.277612Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Model Training","metadata":{"tags":[]}},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\nfrom sklearn.metrics import accuracy_score, f1_score\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.svm import SVC\nfrom sklearn.linear_model import SGDClassifier\nfrom sklearn.ensemble import RandomForestClassifier\nimport catboost","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:30.280790Z","iopub.execute_input":"2023-02-17T08:11:30.281282Z","iopub.status.idle":"2023-02-17T08:11:30.867048Z","shell.execute_reply.started":"2023-02-17T08:11:30.281237Z","shell.execute_reply":"2023-02-17T08:11:30.865807Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_inputs, val_inputs, train_targets, val_targets = train_test_split(inputs, df.target, test_size=0.25, random_state=42)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:30.868672Z","iopub.execute_input":"2023-02-17T08:11:30.869067Z","iopub.status.idle":"2023-02-17T08:11:30.898797Z","shell.execute_reply.started":"2023-02-17T08:11:30.869029Z","shell.execute_reply":"2023-02-17T08:11:30.897599Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_inputs.shape, val_inputs.shape","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:30.900408Z","iopub.execute_input":"2023-02-17T08:11:30.900810Z","iopub.status.idle":"2023-02-17T08:11:30.907959Z","shell.execute_reply.started":"2023-02-17T08:11:30.900770Z","shell.execute_reply":"2023-02-17T08:11:30.906747Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = LogisticRegression(max_iter=1000000, n_jobs=6)\n# model = DecisionTreeClassifier(max_depth=20)\n# model = SGDClassifier(loss=\"hinge\", penalty=\"l2\", max_iter=5)\n# model = catboost.CatBoostClassifier(iterations=100)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:30.911271Z","iopub.execute_input":"2023-02-17T08:11:30.911679Z","iopub.status.idle":"2023-02-17T08:11:30.920524Z","shell.execute_reply.started":"2023-02-17T08:11:30.911618Z","shell.execute_reply":"2023-02-17T08:11:30.919360Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\nmodel.fit(train_inputs, train_targets)","metadata":{"tags":[],"execution":{"iopub.status.busy":"2023-02-17T08:11:30.922276Z","iopub.execute_input":"2023-02-17T08:11:30.922856Z","iopub.status.idle":"2023-02-17T08:11:34.196008Z","shell.execute_reply.started":"2023-02-17T08:11:30.922822Z","shell.execute_reply":"2023-02-17T08:11:34.194466Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_preds = model.predict(train_inputs)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:34.197943Z","iopub.execute_input":"2023-02-17T08:11:34.198356Z","iopub.status.idle":"2023-02-17T08:11:34.208805Z","shell.execute_reply.started":"2023-02-17T08:11:34.198320Z","shell.execute_reply":"2023-02-17T08:11:34.207134Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.Series(train_preds).value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:34.210697Z","iopub.execute_input":"2023-02-17T08:11:34.211051Z","iopub.status.idle":"2023-02-17T08:11:34.222473Z","shell.execute_reply.started":"2023-02-17T08:11:34.211022Z","shell.execute_reply":"2023-02-17T08:11:34.221319Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"accuracy_score(train_preds, train_targets), f1_score(train_targets, train_preds)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:34.224250Z","iopub.execute_input":"2023-02-17T08:11:34.224590Z","iopub.status.idle":"2023-02-17T08:11:34.263767Z","shell.execute_reply.started":"2023-02-17T08:11:34.224552Z","shell.execute_reply":"2023-02-17T08:11:34.262547Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"val_preds = model.predict(val_inputs)\naccuracy_score(val_preds, val_targets), f1_score(val_preds, val_targets)\n\n# 0.50 with Logistic Regression","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:34.265675Z","iopub.execute_input":"2023-02-17T08:11:34.266023Z","iopub.status.idle":"2023-02-17T08:11:34.284391Z","shell.execute_reply.started":"2023-02-17T08:11:34.265992Z","shell.execute_reply":"2023-02-17T08:11:34.282950Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"insincere_df.target.values[:10]","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:34.286373Z","iopub.execute_input":"2023-02-17T08:11:34.286978Z","iopub.status.idle":"2023-02-17T08:11:34.296238Z","shell.execute_reply.started":"2023-02-17T08:11:34.286929Z","shell.execute_reply":"2023-02-17T08:11:34.294556Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Prediction On Test Set","metadata":{"tags":[]}},{"cell_type":"code","source":"sub_df = pd.read_csv(sample_sub)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:34.298014Z","iopub.execute_input":"2023-02-17T08:11:34.298524Z","iopub.status.idle":"2023-02-17T08:11:34.792127Z","shell.execute_reply.started":"2023-02-17T08:11:34.298478Z","shell.execute_reply":"2023-02-17T08:11:34.790540Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_preds = model.predict(test_inputs)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:34.793973Z","iopub.execute_input":"2023-02-17T08:11:34.794357Z","iopub.status.idle":"2023-02-17T08:11:34.816360Z","shell.execute_reply.started":"2023-02-17T08:11:34.794324Z","shell.execute_reply":"2023-02-17T08:11:34.815111Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub_df.prediction = test_preds","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:34.818203Z","iopub.execute_input":"2023-02-17T08:11:34.818640Z","iopub.status.idle":"2023-02-17T08:11:34.825631Z","shell.execute_reply.started":"2023-02-17T08:11:34.818604Z","shell.execute_reply":"2023-02-17T08:11:34.824416Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sub_df.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2023-02-17T08:11:34.828055Z","iopub.execute_input":"2023-02-17T08:11:34.828876Z","iopub.status.idle":"2023-02-17T08:11:35.473056Z","shell.execute_reply.started":"2023-02-17T08:11:34.828838Z","shell.execute_reply":"2023-02-17T08:11:35.472201Z"},"trusted":true},"execution_count":null,"outputs":[]}]}