{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"scrolled":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)\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nfrom sklearn.metrics import accuracy_score\nfrom sklearn.metrics import confusion_matrix, classification_report\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.ensemble import RandomForestClassifier\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":"train_df = pd.read_csv('../input/train.csv')\ntest_df = pd.read_csv('../input/test.csv')\nboth = [train_df, test_df]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"ea04c6d095e7026197775c04f484b1034b70007b"},"cell_type":"code","source":"train_df.info()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"ff8ff834d149bc6e6793ac5e8d9f66e6a78a3e3c"},"cell_type":"code","source":"train_df.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"45da3b029be5121d42a78906ae7c02ae8d0ca7a3"},"cell_type":"code","source":"print(str(len(train_df.index)))","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"7b9b74668167582b87980ddd6111ecc5f4ef096a"},"cell_type":"markdown","source":"# Eploratory data analysis\n** in this section you will see the way to get important information from the data with the help of visualiztions.**"},{"metadata":{"trusted":true,"_uuid":"494953244f87783d37bb791e6f7d888ca9bcf0df"},"cell_type":"code","source":"sns.countplot(x=\"Survived\", data=train_df)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"11ec18379b9bd930c6249eedd9443a5cfb135e43"},"cell_type":"code","source":"sns.countplot(x=\"Survived\", hue=\"Sex\", data=train_df)\n# As shown in plot Females are more than the Males who survived!","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-output":false,"trusted":true,"_uuid":"a8e046f90b723641e1e7a78a46da7aa4ced5b80d"},"cell_type":"code","source":"sns.countplot(x=\"Survived\", hue=\"Pclass\", data=train_df)\n# first class pessanger has the better surviving rate","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"2d649068deb936cde731d2e971929b20edc6ed4b"},"cell_type":"code","source":"train_df.hist(column=\"Age\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"88cfb4477bf9c9480a74fe4f7e8063a7faaea9c1"},"cell_type":"code","source":"train_df.info()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"378e5c4e889b565d296fb59d98347aa2804592b1","scrolled":true},"cell_type":"code","source":"sns.countplot(x='SibSp', data=train_df)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"80479f5c1468394e2dca6e1a2529ec1000b0e14a"},"cell_type":"code","source":"sns.countplot(x='Parch', data=train_df)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"73a79023d51a4683d0a71ddbad7d8613e3fa4738"},"cell_type":"markdown","source":"# Data Wrangling"},{"metadata":{"trusted":true,"_uuid":"11bdfe222b207ce3666f1e98e26f975cb1a8ed3a"},"cell_type":"code","source":"train_df.isnull().sum()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"3f2305155e8bf784d047127d7ef58fc579673148"},"cell_type":"code","source":"test_df.isnull().sum()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"bc5c72bf5c4fb646416430f1bd814a860eca68d3"},"cell_type":"markdown","source":"# Visualizing NaNs\n**using Heatmaps**"},{"metadata":{"trusted":true,"_uuid":"24deff4ed414188f290fbe74b7ad87ff582ff3f0"},"cell_type":"code","source":"sns.heatmap(data=test_df.isnull() )","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"scrolled":true,"_uuid":"a8570689a67f618ec6c5c98674d0b01ddb78110d"},"cell_type":"code","source":"\nsns.heatmap(data=train_df.isnull(), cmap='viridis', yticklabels=False)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"acd7ea9f6aaf937e6aec2c508a98f7b72f87ba69"},"cell_type":"markdown","source":"# processing Age column\n**showing boxplot to find median ages according to Pessanger class**"},{"metadata":{"trusted":true,"_uuid":"ac87d616150c4a97d62846247c4f2f03122289a4"},"cell_type":"code","source":"sns.boxplot(x='Pclass', y='Age', data=train_df)\n","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"e47f7427c6625836e802452d4ec1405f1a9a4857"},"cell_type":"markdown","source":"# Processing NaNs"},{"metadata":{"trusted":true,"_uuid":"749da5bb0561dd8266143b00932417b7e4c5be6e"},"cell_type":"code","source":"def processing_age(cols):\n    Age= cols[0]\n    Pclass = cols[1]\n    if pd.isnull(Age):\n        if Pclass == 1:\n            return 37\n        if Pclass ==2:\n            return 29\n        else:\n            return 24\n    else:\n        return Age\ntrain_df['Age'] = train_df[['Age', 'Pclass']].apply(processing_age, axis=1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"3ccb225df6423494fc655b8fc17f59ea8c9122ea"},"cell_type":"code","source":"# from sklearn.preprocessing import Imputera","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c498eece8e20709cbc4ca1381dcfb280e7ba00a0"},"cell_type":"code","source":"# imputer = Imputer(missing_values=\"NaN\", strategy ='mean', axis=0)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"eded39eec1e7e270abc3cfbce3f72c8f0da3062c"},"cell_type":"code","source":"train_df.head(6)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"6b0e415d28047b4fda22e98f1d36c866af776ff9"},"cell_type":"markdown","source":"# dropping Cabin column\n** theres nothing important in cabin column so we are gonna drop it**"},{"metadata":{"trusted":true,"_uuid":"824d83f47943a83bf4d114ad72e1b6edacaf4044"},"cell_type":"code","source":"train_df.drop('Cabin', axis=1, inplace=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"8496980400474d26758db4c8d9e8d7fdf77dd9c8"},"cell_type":"code","source":"# meanage = train_df[\"Age\"].mean()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"74ac9bc810dd8b744966153b3ebf26242547a5ee"},"cell_type":"code","source":"# /meanage","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"cf06ba551a9121c545b09475d11a599ee00fd8f7"},"cell_type":"code","source":"# medianage = train_df['Age'].median()\n# medianage","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"106f326fad43eb85f144dadc7c7c292f7f295f70"},"cell_type":"markdown","source":"# filling "},{"metadata":{"trusted":true,"_uuid":"52de181bad8e09e49cff1be3509589c5518f4e8a"},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"efd3305dd889ec53aafb10eb82a0720be40f1a7d"},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"adcfc85e2a2d3594b539180315c66fb2e41b371b"},"cell_type":"code","source":"# train_df['Age'].fillna(value=medianage, axis=0, inplace=True)\n# train_df['Age'].fillna(method = \"bfill\", axis=0, inplace=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"39a5a2e89bfa3a16a1e0490356c2e9aa1803c9c0"},"cell_type":"code","source":"# imputer = imputer.fit(train_df.iloc[:, 5:11])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"31a9bdbbf56ff0c986fe3a475cda2902cc1ef6ee"},"cell_type":"code","source":"\n# train_df.dropna(inplace=True)\nsns.heatmap(train_df.isnull(), cbar=False, cmap='viridis')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"b4111cf6b6fdd742c8e17d0d975d6c1c18375542"},"cell_type":"code","source":"# meanagetest = test_df[\"Age\"].mean()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"451efc43d1f0ef111f3ac52c9afca6f47d76ee2c"},"cell_type":"code","source":"# medianagetest = test_df['Age'].median()\n# medianagetest","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"5105063996e97a2ae53f6000ff05aed42354de89"},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"576da697413b8f6cc14d5efd1d83cece57231dd0"},"cell_type":"markdown","source":"# Filling\n"},{"metadata":{"trusted":true,"_uuid":"8c7537b0be878174f0b5c2522af3973f9c1660ff"},"cell_type":"code","source":"test_df.isnull().sum()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"3e29e076376cd85f8c2fbde11603a4eae41cc954"},"cell_type":"code","source":"test_df['Age'] = test_df[['Age', 'Pclass']].apply(processing_age, axis=1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"scrolled":true,"_uuid":"4147652397d28f2d04d83f867e358ff7056f0247"},"cell_type":"code","source":"# test_df['Age'].fillna(value=medianagetest, axis=0, inplace=True)\n# test_df['Age'].fillna(method = \"bfill\", axis=0, inplace=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"e7e1990d9c31b6156fdd0f87f4dabf5cf167e723"},"cell_type":"code","source":"test_df.drop('Cabin', axis=1, inplace=True)\n# test_df.dropna(inplace=True)\nfinal = test_df\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"36cf3e136a0fe8edec01e1fdb2b6940ebe71785f"},"cell_type":"code","source":"sns.heatmap(test_df.isnull(), cbar=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c00ef8ee0a09f746ce52c74aa6addea838040b44"},"cell_type":"code","source":"train_df.isnull().sum()\ntest_df.isnull().sum()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"786a28319bf5d1912839fa35da179eb81cf3c7e5"},"cell_type":"markdown","source":"# Creating Dummy Varibles for categorical data"},{"metadata":{"trusted":true,"_uuid":"fca639a5cbe3fbc589e568ec019df5e22fb1db11"},"cell_type":"code","source":"pclass = pd.get_dummies(train_df['Pclass'], drop_first=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"b0d152dcfb525667681479cff81931a342f6e652"},"cell_type":"code","source":"sex = pd.get_dummies(train_df['Sex'], drop_first=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"f3afb32e8707335853c43b458d67daaf34fb606b"},"cell_type":"code","source":"embark =  pd.get_dummies(train_df['Embarked'], drop_first=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"719526243ef0ea6f4bc8896f0b193a3790256b5b"},"cell_type":"code","source":"embark.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c09b319abdd7fb9955d76f0a0312794d9f5a6c08"},"cell_type":"code","source":"train_df=pd.concat([train_df, embark, sex, pclass], axis=1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"b868c33401dbd0898e00e4653bd75441407a5728"},"cell_type":"code","source":"train_df.info()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"b6d66037e7f0c42c1d5e2029a2402a475dc6a02c"},"cell_type":"code","source":"train_df.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"d689f691509a2edc79e18e0b0a388bcd575c6798"},"cell_type":"code","source":"pclass = pd.get_dummies(test_df['Pclass'], drop_first=True)\nsex = pd.get_dummies(test_df['Sex'], drop_first=True)\nembark =  pd.get_dummies(test_df['Embarked'], drop_first=True)\ntest_df=pd.concat([test_df, embark, sex, pclass], axis=1)\ntest_df.head()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"4087f5621cb5d7f365e8928365c04a67b2f5a7b8"},"cell_type":"markdown","source":"# preparing Data"},{"metadata":{"trusted":true,"_uuid":"07bc5496bba0c4124d516dd0bc992dfd2cfadd80"},"cell_type":"code","source":"train_df.drop(['Pclass', 'Embarked', 'PassengerId','Ticket', 'Name', 'Sex', 'Fare'], axis=1, inplace=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"f5c32e09b59bccd15b711c74cf210e814a9a5fee"},"cell_type":"code","source":"train_df.to_csv(\"titanic_cleaned_data.csv\", index=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"9bbb779f6a8e362d02353316126cd0f3b91f0187"},"cell_type":"code","source":"# train_df.drop('Ticket', axis=1, inplace=True)\ntrain_df.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"7202285a0ba4cc71393427f9a122c92446a04691"},"cell_type":"code","source":"test_df.drop(['Pclass', 'Embarked', 'PassengerId', 'Ticket','Name', 'Sex', 'Fare'], axis=1, inplace=True)\ntest_df.to_csv(\"cleaned_test_df.csv\")\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"572d07dd1516926af54ca89c0e74483b442ec8c4"},"cell_type":"code","source":"# test_df.drop('Ticket', axis=1, inplace=True)\n# test_df.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"d38edc7bb8a2b890469034f56ea07d71832e1f30"},"cell_type":"code","source":"test_df.head()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"2fd80455c6140a0a13c3dd0f4c2246e7095bd03a"},"cell_type":"markdown","source":"# Training data"},{"metadata":{"trusted":true,"_uuid":"995a3faf83e7573056de382ec7440a473eec6510"},"cell_type":"code","source":"X = train_df.drop(\"Survived\", axis=1)\ny = train_df[\"Survived\"]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a59ce26e23dbcc7a7bb52cf698bf714462492e29"},"cell_type":"code","source":"from sklearn.model_selection import train_test_split","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"b1df45dd21f2edea7c334c5a960285288c63e7c1"},"cell_type":"code","source":"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state=0)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"efb251bd6f815793dbfbc85e206124bcdefe1e22"},"cell_type":"markdown","source":"# Random Forest"},{"metadata":{"trusted":true,"_uuid":"bc8a81400864ea776547dd49c2ac69a0645475c0"},"cell_type":"code","source":"from sklearn.ensemble import RandomForestClassifier\nclf = RandomForestClassifier()\nclf.fit(X_train, y_train)\nrandomfpredictor = clf.predict(X_test)\nsc0=accuracy_score(y_true=y_test, y_pred=randomfpredictor)\nprint(\"Accuracy Score: \", accuracy_score(y_true=y_test, y_pred=randomfpredictor))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"scrolled":true,"_uuid":"e0be866054d87a03c6fef062c6adab1335640563"},"cell_type":"code","source":"rfprediction = clf.predict(test_df)\nprint(confusion_matrix(y_test, randomfpredictor))\nprint(classification_report(y_test, randomfpredictor))","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"740e236f202a4bba03f084c2b0fde3f1da24fd3e"},"cell_type":"markdown","source":"# Logistic regression"},{"metadata":{"trusted":true,"_uuid":"9fa4dab8e246c883a20b85b1311cb2d018be308b"},"cell_type":"code","source":"from sklearn.linear_model import LogisticRegression\nreg = LogisticRegression()\nreg.fit(X_train, y_train)\nsurvived = reg.predict(X_test)\nsc1=accuracy_score(y_true=y_test, y_pred=survived)\nprint(\"Accuracy Score: \", accuracy_score(y_true=y_test, y_pred=survived))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1f6774c51fbcbf71bcbfdbf1522add3c39139cc7","scrolled":true},"cell_type":"code","source":"prediction = reg.predict(test_df)\nprint(confusion_matrix(y_test, survived))\nprint(classification_report(y_test, survived))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"676c797f061e969aa3925267d12dd8a0b1827652"},"cell_type":"markdown","source":"# K Nearest Neighbours"},{"metadata":{"trusted":true,"_uuid":"4bde3483b4206134f906db5c7ed5acebf6f096e4"},"cell_type":"code","source":"from sklearn.neighbors import KNeighborsClassifier\nknn = KNeighborsClassifier(n_neighbors=5)\nknn.fit(X_train, y_train)\nsurvivedknn = knn.predict(X_test)\nsc2=accuracy_score(y_true=y_test, y_pred=survivedknn)\nprint(\"Accuracy Score: \", accuracy_score(y_true=y_test, y_pred=survivedknn))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c365e40ee2a567d3b869796d3a90fb044b4c0061"},"cell_type":"code","source":"predictionknn = knn.predict(test_df)\nprint(confusion_matrix(y_test, survivedknn))\nprint(classification_report(y_test, survivedknn))","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"01e10a02c622229fe14116c862bcfe05986e4537"},"cell_type":"markdown","source":"# Support vector classifier\n"},{"metadata":{"trusted":true,"_uuid":"3e9214e4e31c9cc27a47221a93dfa5765f8ef0f4"},"cell_type":"code","source":"from sklearn.svm import SVC\nsvc = SVC()\nsvc.fit(X_train, y_train)\nsurvivedsvc = knn.predict(X_test)\nsc3=accuracy_score(y_true=y_test, y_pred=survivedsvc)\nprint(\"Accuracy Score: \", accuracy_score(y_true=y_test, y_pred=survivedsvc))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"bc23fe34022f16b3d9b5cfb2086b04f2cb8dd722","scrolled":true},"cell_type":"code","source":"predsvc = knn.predict(test_df)\nprint(confusion_matrix(y_test, survivedsvc))\nprint(classification_report(y_test, survivedsvc))","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"74268fe3a7087d60b792c41abd2a0462a611988f"},"cell_type":"markdown","source":"**Tuning the parameters for SVC**"},{"metadata":{"trusted":true,"_uuid":"fac9de4a2097e95fdfd65191c11df5cd86952634","scrolled":true},"cell_type":"code","source":"from sklearn.model_selection import GridSearchCV\nparam_grid={'C':[0.1, 1, 10, 100], 'gamma':[ 1,0.1, 0.001, 0.0001]}\ngrid = GridSearchCV(SVC(), param_grid, verbose=2)\ngrid.fit(X_train, y_train)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c7c17d0ee6d5a270b3908ff9eb00a25a6b282793"},"cell_type":"code","source":"print(grid.best_params_)\n# print(grid.best_estimator_)\nsc4=grid.best_score_\nprint(grid.best_score_)\ngridpred = grid.predict(X_test)\nprint(confusion_matrix(y_test, gridpred))\nprint(classification_report(y_test, gridpred))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"186b8e216de41e8532ed2dd1040d1af92c4f0e68"},"cell_type":"code","source":"dict1 = {'Logistic Regression':sc1, 'Random Forest':sc0, 'Support vector classifier':sc2, 'KNearestNeighbours':sc3}","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"97add9b142d29125b3697229aaa8ebbe03f5b1b0"},"cell_type":"code","source":"models=pd.DataFrame({\"Models\":['Logistic Regression', 'Random Forest', 'Support vector classifier', 'KNearest Neighbours'], \n             'Score':[sc1,sc0, sc4, sc3]\n             })\n\nmodels.sort_values(by='Score', ascending=False)\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"950d994f58e4b0692b61d8ef7657b5476e353d8b"},"cell_type":"code","source":"final.drop(['Pclass', 'Name', 'Sex','Age', 'SibSp', 'Ticket', 'Fare', 'Embarked', 'Parch'], axis=1, inplace=True)\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1ce93b75c7cd9a6b775dce0cb8cbe7746b789f4f"},"cell_type":"code","source":"randomFinal = final\nsvcfinal  = final\nrandomFinal[\"Survived\"] = rfprediction\nrandomFinal.to_csv('randomForestResult.csv', index=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"ceb14b0e78af8ae5a1056d6792801c92d6e7b47b"},"cell_type":"code","source":"final['Survived'] = prediction\nfinal.to_csv('Subbmission.csv', index=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"99a40bd3693985698ae23f835acc3f52d146a09e"},"cell_type":"code","source":"svcfinal['Survived'] = prediction\nfinal.to_csv('svcsurvived.csv', index=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a7766b75ebb85e60052a9039e73aa9471fe51a44"},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1fc25b709867e2626156b4a652302dcea05db3dc"},"cell_type":"code","source":"# final.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"4f9d60e14105f299e989bc9d3b7d1823281e4261"},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"2d51563c267c63b850026def963d794b1b73164b"},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a0368e994ad44ae89c0bf8c2033dfcf905527ea9"},"cell_type":"code","source":"","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}