{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"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 in \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 \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nimport os\nprint(os.listdir(\"../input\"))\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"import pandas as pd\nimport re\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport numpy as np","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"e02cbcf30a4844990251cdb31453b122566137c1"},"cell_type":"markdown","source":"## Input Data"},{"metadata":{"trusted":true,"_uuid":"d26c134d1428e7225130917ded5a2db608031892"},"cell_type":"code","source":"train = pd.read_csv('../input/train.csv')\ntest = pd.read_csv('../input/test.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c7404559c5cb680376b22e53235953b92b115721"},"cell_type":"code","source":"train.head(10)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"f6b4bed45cdbad0e19ede535f383a61c8a179ab5"},"cell_type":"code","source":"train['question_text'][0]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"cbf1a4573b76b0af694c05b5c846ffb88f5f63b1"},"cell_type":"code","source":"train.tail(10)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"177c4ea493471e7abfbe7799718da35dbaa68326"},"cell_type":"markdown","source":"## Eliminate ' and \" from Data"},{"metadata":{"trusted":true,"_uuid":"b4dc2cb45a771f9c3be3dd7f307a0b4516b3d072"},"cell_type":"code","source":"train['question_text'] = train['question_text'].str.replace('\"', '')\ntrain['question_text'] = train['question_text'].str.replace(\"'\", '')","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"9dc8afac36d85b51fca4060a038f08b5f1018364"},"cell_type":"markdown","source":"## Deviding sentences by words"},{"metadata":{"trusted":true,"_uuid":"c51abd87dbe042b8734e193cc8a15848e81c9989"},"cell_type":"code","source":"words=[]\nlengths=[]\nfor i in range(1306122):\n    a = re.findall(r\"[\\w']+|[,!?;/]\", train['question_text'][i])\n    words.append(a)\n    lengths.append(len(words[i]))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c8de37b1f8e17774bdba9814a8cf0136d3d2dded"},"cell_type":"markdown","source":"## Binning the Data"},{"metadata":{"trusted":true,"_uuid":"2f52e93b8d403bd5bd8c5bbc2e5d3a97e8ea393e"},"cell_type":"code","source":"binwidth = 20\nbins = [i for i in range(0,220,20)]\ngroup_names = ['0-20', '20-40', '40-60', '60-80', '80-100', '100-120', '120-140', '140-160', '160-180','180-200']\ntrain['by_groups'] =pd.cut(lengths,bins, labels = group_names)\ntrain['bin_lengths']=lengths","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"7a5c21d74f4c4d6a375e6bd0345465e556602caa"},"cell_type":"markdown","source":"## Visualizations"},{"metadata":{"trusted":true,"_uuid":"3398c9f0b100eb4b8085c6fa5fa88fc4182b9970"},"cell_type":"code","source":"sns.barplot(x=\"by_groups\", y=\"bin_lengths\", data=train)\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"2128128ab0c2d28638540e596d2340a3f0c04f2a"},"cell_type":"code","source":"plt.hist(train['bin_lengths'], color='orange')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"cfeb2ed065c03ea813d408d915db40107f1aae0f"},"cell_type":"code","source":"train['by_groups'].value_counts()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"f632bc50d6915307c50c0f338cfbd1fa37482be0"},"cell_type":"code","source":"val_count = train['by_groups'].value_counts()\nval_count[0]","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"f22aefed2786d3ae5a7d71187fa398672e45946a"},"cell_type":"markdown","source":"## Elimination of more longer five sentences"},{"metadata":{"trusted":true,"_uuid":"387cbeedf9c3144518a58fd9d8b9802503ae68b9"},"cell_type":"code","source":"print('max index =', lengths.index(max(lengths)),'max =',train['bin_lengths'].max())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"ef0875e42a827694b936d7e2d7ac0a73cc9f7e6b"},"cell_type":"code","source":"train.drop([443216],inplace = True)\ndel words[443216]\ndel lengths[443216]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"2b717ad858f6dfb070fdbc03444f6d881bebedb9"},"cell_type":"code","source":"print('max index =', lengths.index(max(lengths)),'max =',train['bin_lengths'].max())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"962b0f0c4fd14e8cf2a338af0fc14bbdc99ca428"},"cell_type":"code","source":"del lengths[163583]\ndel words[163583]\ntrain.drop(train.index[163583],inplace = True);","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c4cb0206383dd4a5a5d9f296ffc0b37831ee2c64"},"cell_type":"code","source":"print('max index =', lengths.index(max(lengths)),'max =',train['bin_lengths'].max())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"9fdbaf0b5113b4838ef30a10b3de0899827eada2"},"cell_type":"code","source":"del lengths[522264]\ndel words[522264]\ntrain.drop(train.index[522264],inplace = True);","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"129efe5b9e1ab091a1f1b4bf5356bdc26345a17c"},"cell_type":"code","source":"print('max index =', lengths.index(max(lengths)),'max =',train['bin_lengths'].max())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"0dcbdd9f34bb7c472bd7330ae90733d9111217e7"},"cell_type":"code","source":"del lengths[341311]\ndel words[341311]\ntrain.drop(train.index[341311],inplace = True);","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"9238416708e165026f5020c33530cf1686e747b5"},"cell_type":"code","source":"print('max index =', lengths.index(max(lengths)),'max =',train['bin_lengths'].max())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"8b9076004b6c4f6db78c40a316afc77440bf7e35"},"cell_type":"code","source":"del lengths[1215717 ]\ndel words[1215717 ]\ntrain.drop(train.index[1215717 ],inplace = True);","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c4cffbae86ec80cea9cabd2a0877746f8d42fb1f"},"cell_type":"code","source":"print('max index =', lengths.index(max(lengths)),'max =',train['bin_lengths'].max())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"480861b57e479d492dc03832b21a54be190e4e89"},"cell_type":"code","source":"train.reset_index(drop=True, inplace=True)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"fecd22e642acf01c43ef22361d0d050eacff4a6d"},"cell_type":"markdown","source":"## Encoding of words and characters"},{"metadata":{"trusted":true,"_uuid":"ebbce1877c6fad7285690444958fd9413fa535f5"},"cell_type":"code","source":"wordset = []\nfor i in range(1306117):\n    wordset.extend(words[i])\nlen(wordset)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"64f36b0a2f1e0826fdd5f96e3f325802a4147b20"},"cell_type":"code","source":"wordsetset = set(wordset)\nlen(wordsetset)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"35baffda061f115b32c9c56ed35de0baadf07516"},"cell_type":"markdown","source":"## New DataFrame"},{"metadata":{"trusted":true,"_uuid":"9b6a7def1ce02c820649a1ecb15a4b5726e26f7c"},"cell_type":"code","source":"wordlist = list(wordsetset)\nnum_wordlist = [i for i in range(1,len(wordlist))]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"25db57dd07db572289cb7d5155eb0aa1ebb19869"},"cell_type":"code","source":"numdict = dict(zip(wordlist, num_wordlist))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"8abb6a33ce15be76f61604751877a5060f8f1fd3"},"cell_type":"code","source":"n=len(train['question_text'])\nm=train['bin_lengths'].max()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"0203eb404b72c90b52a3887d4807e6cbbf04f26b"},"cell_type":"code","source":"for j in range(n):\n    for i in range(len(words[j]), m):\n        words[j].append(0)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"698668b9549431ec3a94aaf8e104018bc84eb821"},"cell_type":"code","source":"word_list = [i for i in range(0,75)]\ncol_names =  ['qid']\ncol_names.extend(word_list)\ncol_names.append('target')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1015dbb2df6e6d2cc8d75c9c6386b8b2c2530b3a"},"cell_type":"code","source":"my_df  = pd.DataFrame(columns = col_names)\nmy_df","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c9875dc253f481b8c9194c186fdf09efe7fb16d1"},"cell_type":"code","source":"my_df['qid'] = train['qid']\nmy_df['target'] = train['target']","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"989cea6a78097f6304a4ff1c27f385c410a9071b"},"cell_type":"code","source":"for i in range(0,1275001,25000):\n    my_df.iloc[i:i+25000,1:76]=words[i:i+25000]\nmy_df.iloc[1300000:1306121,1:76]=words[1300000:1306121]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"39980df2f1591bef96bdf4121921f21c34ebeb20"},"cell_type":"code","source":"my_df","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"7753702f5123789da6018855e9f890b5d863622c"},"cell_type":"code","source":"my_df[0]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"ffbabad672b99960a9246f031f5a85a05d7f0077"},"cell_type":"code","source":"my_df[0] = my_df[0].map(numdict)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"5e1b832416360a4f2455803645b4513bca4f0b09"},"cell_type":"code","source":"my_df[0]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"09f5e46ae2d32817c693e80250810814f99bbdeb"},"cell_type":"code","source":"my_df[1] = my_df[1].map(numdict)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"9356bfdd59129643c9a740ecac9cc27ed9f63b52"},"cell_type":"code","source":"my_df[1]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"99d5427ca6a8b7a8bf95664437f97214fecb1384"},"cell_type":"code","source":"for i in range(2,75):\n    my_df[i] = my_df[i].map(numdict)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"6569e926047b71aeeeaad629981994ca4e9d3145"},"cell_type":"code","source":"my_df","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"38d5d8b83cd7ae7176e3817471af1529a9702743"},"cell_type":"code","source":"my_df = my_df.fillna(0)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1c4217136022b4811fc02c3a0f8e3a4cc1554d1e"},"cell_type":"code","source":"my_df","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"5215617209d19afb30c70da27851f47852d3e129"},"cell_type":"code","source":"my_df.info()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1736308e704e184afb4eb5c0193dea35128c7850"},"cell_type":"code","source":"test.head(10)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c90d9a66287e76d75068d624d4be7f42cebb0a72"},"cell_type":"code","source":"test.tail(10)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"e2cbdae260145a925c6b0b7e91415be6e4aafa4a"},"cell_type":"code","source":"test['question_text'] = test['question_text'].str.replace('\"', '')\ntest['question_text'] = test['question_text'].str.replace(\"'\", '')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"411da844b1947b28b25f0331734768f10ee0d794"},"cell_type":"code","source":"words_test=[]\nlengths_test=[]\nfor i in range(56370):\n    a_test = re.findall(r\"[\\w']+|[,!?;/]\", test['question_text'][i])\n    words_test.append(a_test)\n    lengths_test.append(len(words_test[i]))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"6c6244c15c6442204d5789ef5fe281a5b5c4defd"},"cell_type":"code","source":"binwidth = 20\nbins = [i for i in range(0,220,20)]\ngroup_names_test = ['0-20', '20-40', '40-60', '60-80', '80-100', '100-120', '120-140', '140-160', '160-180','180-200']\ntest['by_groups'] =pd.cut(lengths_test,bins, labels = group_names_test)\ntest['bin_lengths']=lengths_test","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"cb404e653d1af808780e5ba8601862d0258a245c"},"cell_type":"code","source":"sns.barplot(x=\"by_groups\", y=\"bin_lengths\", data=test)\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"ebb914e0ed946744c1b1c40552a9a79968d71839"},"cell_type":"code","source":"plt.hist(test['bin_lengths'], color='orange')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"8a2671b388f4b1ca41fdfcdc7db6c15e37c92829"},"cell_type":"code","source":"test['by_groups'].value_counts()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1305489dc8ff6bf2e49d06ff289d2d8c66b39336"},"cell_type":"code","source":"print('max index =', lengths_test.index(max(lengths_test)),'max =',test['bin_lengths'].max())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"6c366fb4e5044a1cd0d23888f1cca6b8f0d056ec"},"cell_type":"code","source":"words_test[8785]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"71ff4c7705aad5cabc1d7450ca63290aa541a2cb"},"cell_type":"code","source":"test['question_text'][8785]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"8f33e34a7635e2309caea1a42152447e70ac0ad0"},"cell_type":"code","source":"words_test[8785] = ['What','is','?']\ntest['question_text'][8785] = \"What is?\"\nlengths_test[8785] = 3","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"d23c1d749a6d6e580a089d073ff8309665385257"},"cell_type":"code","source":"print('max index =', lengths_test.index(max(lengths_test)),'max =',test['bin_lengths'].max())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"e7587693332301ca30093c4eae26b249f69b52aa"},"cell_type":"code","source":"words_test[6864]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"bf218962bae52709c9083082356cc7226b1ff522"},"cell_type":"code","source":"len(words_test[6864])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"58a0448276f608e490edcf8f40fa11df16a083bc"},"cell_type":"code","source":"test['question_text'][6864]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"b583495b460eb9308ab371237c2ceeb9e6c8f85a"},"cell_type":"code","source":"words_test[6864] = ['Should', 'I', 'be', 'concerned', 'if', 'my', 'mum', 'always', 'perves', 'on', 'me', 'when', 'im', 'in', 'the', 'shower', 'i', 'get', 'horny', 'want', 'to', 'fuck', 'her', 'because', 'i', 'get', 'a', 'hard', 'cock', 'because', 'she', 'just', 'stares', 'at', 'me', 'for', 'ages', 'while', 'she', 'plays', 'with', 'herself']\ntest['question_text'][6864] = 'Should I be concerned if my mum always perves on me when im in the shower i get horny want to fuck her because i get a hard cock because she just stares at me for ages while she plays with herself?'\nlengths_test[6864] = 42","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"50199f12eac0075e322d7f59cae125f88ff60287"},"cell_type":"code","source":"len(words_test[6864])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"909849ece955d2a45b28fca9f0a6553297ff991d"},"cell_type":"code","source":"n_test=len(test['question_text'])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"608e3d6527c2b17539c09db2c17c386a2ba4c527"},"cell_type":"code","source":"for j in range(n_test):\n    for i in range(len(words_test[j]), 75):\n        words_test[j].append(0)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"d3757f1037f4c18e47cd158e2e65a787db7997b7"},"cell_type":"code","source":"word_list_test = [i for i in range(0,75)]\ncol_names_test =  ['qid']\ncol_names_test.extend(word_list_test)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"50dc66ca636931aa1ae5306e0fc0644d0461d8af"},"cell_type":"code","source":"my_df_test  = pd.DataFrame(columns = col_names_test)\nmy_df_test","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"d56209843fdf992a6247a56d8d47d0c8acb1cd8d"},"cell_type":"code","source":"my_df_test['qid'] = test['qid']","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"07b414697381eef1efb3b8f7719f67dc78becf92"},"cell_type":"code","source":"for i in range(0,25001,25000):\n    my_df_test.iloc[i:i+25000,1:76]=words_test[i:i+25000]\nmy_df_test.iloc[50000:56369,1:76]=words_test[50000:56369]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"06e00620fab63d3b89c6bc8393904c96985caaa8"},"cell_type":"code","source":"my_df_test","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"d12a850cb2bf8865554bf3db564cb90dc823ab77"},"cell_type":"code","source":"my_df_test[0] = my_df_test[0].map(numdict)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"b69caf2529ad71f6c82f623089c087d5c672ccbe"},"cell_type":"code","source":"my_df_test[1] = my_df_test[1].map(numdict)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"9c2c3c50206dcacc2406058f7d0fdd9d5f1a9937"},"cell_type":"code","source":"for i in range(2,75):\n    my_df_test[i] = my_df_test[i].map(numdict)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"69353e9c90be67ac98ec8ce83661af9d0c104b03"},"cell_type":"code","source":"my_df_test","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"10d0f9fd72dc6ba02bb73b61fe70f22dad6d4cd7"},"cell_type":"code","source":"my_df_test = my_df_test.fillna(0)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"75d0fca9f38f9c268698f622848e5f146b79e96c"},"cell_type":"code","source":"my_df.info()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"fceb2aff889890b85b9209748397aa28a170cdd3"},"cell_type":"code","source":"my_df_test","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"7459add70802a3eb7bd25fbc667fd6d67c14f381"},"cell_type":"code","source":"y_train = my_df['target']\nx_train  = my_df.iloc[:,1:75]\nx_test = my_df_test.iloc[:,1:75]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"135dad90e929a15deaf35ed2ede267d214638492"},"cell_type":"code","source":"from sklearn.ensemble import GradientBoostingClassifier\n\ngbk = GradientBoostingClassifier()\ngbk.fit(x_train, y_train)\ny_test = gbk.predict(x_test)\n\nacc_gbk = gbk.score(x_train, y_train)\n\nprint(acc_gbk)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"22516eb95e2c2fefdf613a023828b668f8ff761f"},"cell_type":"code","source":"# Random Forest\nfrom sklearn.ensemble import RandomForestClassifier\n\nrandomforest = RandomForestClassifier()\nrandomforest.fit(x_train, y_train)\ny_test_1 = randomforest.predict(x_test)\nacc_randomforest = randomforest.score(x_train, y_train)\nprint(acc_randomforest)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"b5d8f60acdbac894eef75e8514312821f26d41eb"},"cell_type":"code","source":"#Decision Tree\nfrom sklearn.tree import DecisionTreeClassifier\n\ndecisiontree = DecisionTreeClassifier()\ndecisiontree.fit(x_train, y_train)\ny_test_2 = decisiontree.predict(x_test)\nacc_decisiontree = decisiontree.score(x_train, y_train)\nprint(acc_decisiontree)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"42e608796beb0434813e98ef0abc5d007a9fdd84"},"cell_type":"code","source":"models = pd.DataFrame({\n    'Model': ['Gradient Boosting Classifier','Random Forest','Decision Tree'],\n    'Score': [acc_gbk, acc_randomforest, acc_decisiontree]})\nmodels.sort_values(by='Score', ascending=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"03eb0ad7fd4cedf79d6b73ceaf449f013eb4b27e"},"cell_type":"code","source":"ids = test['qid']\n\noutput = pd.DataFrame({ 'qid' : ids, 'prediction': y_test_2})\noutput.to_csv('submission_sedrak.csv', index=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"8735adc0653afbf0b7cbb4b54ccc2d035cdb105c"},"cell_type":"code","source":"output.to_csv('C:\\\\Users\\\\admin\\\\Desktop\\\\ML\\\\Quora\\\\submission_sedrak.csv', index=False)","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}