{"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":"## If you Liked my work, kindly upvote","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-07-30T22:32:43.379384Z","iopub.execute_input":"2022-07-30T22:32:43.379814Z","iopub.status.idle":"2022-07-30T22:32:43.389671Z","shell.execute_reply.started":"2022-07-30T22:32:43.379772Z","shell.execute_reply":"2022-07-30T22:32:43.388407Z"}}},{"cell_type":"code","source":"import random\nimport sklearn\nimport numpy as np\nimport pandas as pd\nfrom sklearn.preprocessing import StandardScaler, OneHotEncoder, LabelEncoder\nfrom sklearn.impute import SimpleImputer\nfrom sklearn_pandas import DataFrameMapper\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.model_selection import GridSearchCV\nfrom sklearn.svm import SVC\nfrom sklearn.linear_model import RidgeClassifier\nfrom sklearn.ensemble import RandomForestClassifier,GradientBoostingClassifier,BaggingClassifier\nfrom sklearn.neighbors import KNeighborsClassifier\nimport plotly.io as pio\nimport plotly.express as px\nimport plotly.graph_objects as go\nfrom plotly.subplots import make_subplots\nfrom plotly.offline import init_notebook_mode, iplot","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import warnings\nwarnings.filterwarnings('ignore')","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:32:43.489445Z","iopub.execute_input":"2022-07-30T22:32:43.490129Z","iopub.status.idle":"2022-07-30T22:32:43.496102Z","shell.execute_reply.started":"2022-07-30T22:32:43.490090Z","shell.execute_reply":"2022-07-30T22:32:43.494839Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=pd.read_csv('../input/titanic/train.csv')\ndata","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:32:43.989132Z","iopub.execute_input":"2022-07-30T22:32:43.989588Z","iopub.status.idle":"2022-07-30T22:32:44.021453Z","shell.execute_reply.started":"2022-07-30T22:32:43.989554Z","shell.execute_reply":"2022-07-30T22:32:44.020350Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## EDA - Data Preprocessing","metadata":{}},{"cell_type":"code","source":"data.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:32:44.139069Z","iopub.execute_input":"2022-07-30T22:32:44.139462Z","iopub.status.idle":"2022-07-30T22:32:44.150465Z","shell.execute_reply.started":"2022-07-30T22:32:44.139429Z","shell.execute_reply":"2022-07-30T22:32:44.149507Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data=data.drop(['Cabin','PassengerId','Name'],axis=1)\ndata['Age']=data['Age'].fillna(data['Age'].median())\ndata=data.dropna()","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:32:44.228954Z","iopub.execute_input":"2022-07-30T22:32:44.229778Z","iopub.status.idle":"2022-07-30T22:32:44.241607Z","shell.execute_reply.started":"2022-07-30T22:32:44.229730Z","shell.execute_reply":"2022-07-30T22:32:44.240660Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Data Visualization","metadata":{}},{"cell_type":"code","source":"df = data\nfig = px.histogram(df, x=\"Survived\", y=None, color=\"Sex\",\n                width=600,height=350,\n                histnorm='percent',\n                color_discrete_map={ \n                    \"male\": \"RebeccaPurple\", \"female\": \"lightsalmon\"\n                },\n                template=\"plotly\"\n                )\nfig.update_layout(title=\" template='plotly'\", \n                  font_family=\"San Serif\",\n                  bargap=0.2,\n                  barmode='group',\n                  titlefont={'size': 24},\n                  legend=dict(\n                  orientation=\"v\", \n                      y=1, \n                      yanchor=\"top\", \n                      x=1.250, \n                      xanchor=\"right\",)                 \n                  )\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:32:44.429207Z","iopub.execute_input":"2022-07-30T22:32:44.429636Z","iopub.status.idle":"2022-07-30T22:32:44.516507Z","shell.execute_reply.started":"2022-07-30T22:32:44.429601Z","shell.execute_reply":"2022-07-30T22:32:44.515567Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"colors = ['rgba(38, 24, 74, 0.8)', 'rgba(71, 58, 131, 0.8)',\n          'rgba(122, 120, 168, 0.8)', 'rgba(164, 163, 204, 0.85)',\n          'rgba(190, 192, 213, 1)']\n\nfig = px.histogram(data, \n                   y=\"Pclass\",\n                   orientation='h',\n                   width=800,\n                   height=350,\n                   histnorm='percent',\n                   template=\"plotly_dark\"\n                   )\nfig.update_layout(title=\"<b>Number of people who Survived<b>\", \n                  font_family=\"San Serif\",\n                  bargap=0.2,\n                  barmode='group',\n                  titlefont={'size': 28},\n                  paper_bgcolor='lightgray',\n                  plot_bgcolor='lightgray',\n                  legend=dict(\n                  orientation=\"v\", \n                      y=1, \n                      yanchor=\"top\", \n                      x=1.250, \n                      xanchor=\"right\",)                 \n                  )\nannotations = []\nannotations.append(dict(xref='paper', yref='paper',\n                        x=0.0, y=1.2,\n                        text='Total Percentage according to Pclass',\n                             font=dict(family='Arial', size=16, color=colors[2]),\n                        showarrow=False))\n\nfig.update_layout(\n    autosize=False,\n    width=600,\n    height=350,\n    margin=dict(\n        l=50,\n        r=50,\n        b=50,\n        t=120,\n    ),\n)\n\nfig.update_layout(annotations=annotations)\nfig.update_xaxes(showgrid=False)\nfig.update_yaxes(showgrid=False)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:32:44.518507Z","iopub.execute_input":"2022-07-30T22:32:44.519154Z","iopub.status.idle":"2022-07-30T22:32:44.610301Z","shell.execute_reply.started":"2022-07-30T22:32:44.519105Z","shell.execute_reply":"2022-07-30T22:32:44.609186Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y=data['Survived']\nX=data.drop('Survived',axis=1)","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:32:44.649351Z","iopub.execute_input":"2022-07-30T22:32:44.650100Z","iopub.status.idle":"2022-07-30T22:32:44.656826Z","shell.execute_reply.started":"2022-07-30T22:32:44.650042Z","shell.execute_reply":"2022-07-30T22:32:44.655539Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mapper=DataFrameMapper([(['Pclass','Sex','Ticket','Embarked'],sklearn.preprocessing.OneHotEncoder()),\n                       (['Fare','Age'],sklearn.preprocessing.StandardScaler())],df_out=True)","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:32:44.819333Z","iopub.execute_input":"2022-07-30T22:32:44.819766Z","iopub.status.idle":"2022-07-30T22:32:44.825917Z","shell.execute_reply.started":"2022-07-30T22:32:44.819730Z","shell.execute_reply":"2022-07-30T22:32:44.824687Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X=mapper.fit_transform(X)","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:32:44.827629Z","iopub.execute_input":"2022-07-30T22:32:44.828194Z","iopub.status.idle":"2022-07-30T22:32:44.972556Z","shell.execute_reply.started":"2022-07-30T22:32:44.828154Z","shell.execute_reply":"2022-07-30T22:32:44.971450Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train, X_test, y_train, y_test = train_test_split(X, y,random_state=42)","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:32:44.974579Z","iopub.execute_input":"2022-07-30T22:32:44.974934Z","iopub.status.idle":"2022-07-30T22:32:44.985724Z","shell.execute_reply.started":"2022-07-30T22:32:44.974902Z","shell.execute_reply":"2022-07-30T22:32:44.984515Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:32:44.991447Z","iopub.execute_input":"2022-07-30T22:32:44.992044Z","iopub.status.idle":"2022-07-30T22:32:45.045554Z","shell.execute_reply.started":"2022-07-30T22:32:44.991990Z","shell.execute_reply":"2022-07-30T22:32:45.044547Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Binary Classification","metadata":{}},{"cell_type":"markdown","source":"### Logistic Regression","metadata":{}},{"cell_type":"code","source":"pipeline=Pipeline(steps=[(\"model\",LogisticRegression())])","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:12:56.458465Z","iopub.execute_input":"2022-07-30T22:12:56.459382Z","iopub.status.idle":"2022-07-30T22:12:56.465001Z","shell.execute_reply.started":"2022-07-30T22:12:56.459338Z","shell.execute_reply":"2022-07-30T22:12:56.462967Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"solvers = ['newton-cg', 'lbfgs', 'liblinear']\npenalty = ['l2']\nc_values = [100, 10, 1.0, 0.1, 0.01,]\n# define grid search\ngrid = {\"model__solver\":solvers,\"model__penalty\":penalty,\"model__C\":c_values}\n\n\nfit_params = {\"eval\": [(X_test, y_test)], \n              \"stopping_rounds\": 10, \n              \"verbose\": False} \n\nsearchCV = GridSearchCV(pipeline, cv=5, param_grid=grid)\nsearchCV.fit(X_train, y_train)  ","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:12:59.077963Z","iopub.execute_input":"2022-07-30T22:12:59.078373Z","iopub.status.idle":"2022-07-30T22:13:06.292645Z","shell.execute_reply.started":"2022-07-30T22:12:59.078340Z","shell.execute_reply":"2022-07-30T22:13:06.291433Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"searchCV.best_params_","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:13:06.294828Z","iopub.execute_input":"2022-07-30T22:13:06.297206Z","iopub.status.idle":"2022-07-30T22:13:06.309426Z","shell.execute_reply.started":"2022-07-30T22:13:06.297148Z","shell.execute_reply":"2022-07-30T22:13:06.308269Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions=searchCV.predict(X_test)","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:13:14.598757Z","iopub.execute_input":"2022-07-30T22:13:14.599170Z","iopub.status.idle":"2022-07-30T22:13:14.617026Z","shell.execute_reply.started":"2022-07-30T22:13:14.599138Z","shell.execute_reply":"2022-07-30T22:13:14.615873Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(sklearn.metrics.classification_report(y_test, predictions))","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:13:14.802657Z","iopub.execute_input":"2022-07-30T22:13:14.803089Z","iopub.status.idle":"2022-07-30T22:13:14.814511Z","shell.execute_reply.started":"2022-07-30T22:13:14.803055Z","shell.execute_reply":"2022-07-30T22:13:14.813538Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(sklearn.metrics.accuracy_score(y_test,predictions))","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:13:17.467749Z","iopub.execute_input":"2022-07-30T22:13:17.468180Z","iopub.status.idle":"2022-07-30T22:13:17.475185Z","shell.execute_reply.started":"2022-07-30T22:13:17.468140Z","shell.execute_reply":"2022-07-30T22:13:17.474154Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Ridge Classifier","metadata":{}},{"cell_type":"code","source":"pipeline=Pipeline(steps=[(\"model\",RidgeClassifier())])","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:13:20.232936Z","iopub.execute_input":"2022-07-30T22:13:20.233647Z","iopub.status.idle":"2022-07-30T22:13:20.238171Z","shell.execute_reply.started":"2022-07-30T22:13:20.233609Z","shell.execute_reply":"2022-07-30T22:13:20.237146Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"alpha = list(np.linspace(0,10,100))\n# define grid search\ngrid = {\"model__alpha\":alpha}\n\n\nfit_params = {\"eval\": [(X_test, y_test)], \n              \"stopping_rounds\": 10, \n              \"verbose\": False} \n\nsearchCV = GridSearchCV(pipeline, cv=5, param_grid=grid)\nsearchCV.fit(X_train, y_train)  ","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:13:20.652634Z","iopub.execute_input":"2022-07-30T22:13:20.653015Z","iopub.status.idle":"2022-07-30T22:14:11.684204Z","shell.execute_reply.started":"2022-07-30T22:13:20.652982Z","shell.execute_reply":"2022-07-30T22:14:11.683085Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"searchCV.best_params_","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:14:11.691113Z","iopub.execute_input":"2022-07-30T22:14:11.694691Z","iopub.status.idle":"2022-07-30T22:14:11.711042Z","shell.execute_reply.started":"2022-07-30T22:14:11.694620Z","shell.execute_reply":"2022-07-30T22:14:11.709722Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions=searchCV.predict(X_test)\nprint(sklearn.metrics.classification_report(y_test, predictions))","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:14:11.713763Z","iopub.execute_input":"2022-07-30T22:14:11.715814Z","iopub.status.idle":"2022-07-30T22:14:11.782518Z","shell.execute_reply.started":"2022-07-30T22:14:11.715752Z","shell.execute_reply":"2022-07-30T22:14:11.778885Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(sklearn.metrics.accuracy_score(y_test,predictions))","metadata":{"execution":{"iopub.status.busy":"2022-07-30T22:14:11.784544Z","iopub.execute_input":"2022-07-30T22:14:11.785219Z","iopub.status.idle":"2022-07-30T22:14:11.802743Z","shell.execute_reply.started":"2022-07-30T22:14:11.785173Z","shell.execute_reply":"2022-07-30T22:14:11.801271Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### KNN ","metadata":{}},{"cell_type":"code","source":"pipeline=Pipeline(steps=[(\"model\",KNeighborsClassifier())])","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:18:23.112775Z","iopub.execute_input":"2022-07-15T10:18:23.113160Z","iopub.status.idle":"2022-07-15T10:18:23.118653Z","shell.execute_reply.started":"2022-07-15T10:18:23.113130Z","shell.execute_reply":"2022-07-15T10:18:23.117739Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"n_neighbors = range(1, 26, 2)\nweights = ['uniform', 'distance']\nmetric = ['euclidean', 'manhattan', 'minkowski']\ngrid = {\"model__n_neighbors\":n_neighbors,\"model__weights\":weights,\"model__metric\":metric}\n\n\nfit_params = {\"eval\": [(X_test, y_test)], \n              \"stopping_rounds\": 10, \n              \"verbose\": False} \n\nsearchCV = GridSearchCV(pipeline, cv=5, param_grid=grid)\nsearchCV.fit(X_train, y_train)  ","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:19:23.366659Z","iopub.execute_input":"2022-07-15T10:19:23.367139Z","iopub.status.idle":"2022-07-15T10:19:43.005396Z","shell.execute_reply.started":"2022-07-15T10:19:23.367089Z","shell.execute_reply":"2022-07-15T10:19:43.004278Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"searchCV.best_params_","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:19:43.007573Z","iopub.execute_input":"2022-07-15T10:19:43.008291Z","iopub.status.idle":"2022-07-15T10:19:43.021387Z","shell.execute_reply.started":"2022-07-15T10:19:43.008242Z","shell.execute_reply":"2022-07-15T10:19:43.020199Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions=searchCV.predict(X_test)\nprint(sklearn.metrics.classification_report(y_test, predictions))","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:19:43.028096Z","iopub.execute_input":"2022-07-15T10:19:43.031731Z","iopub.status.idle":"2022-07-15T10:19:43.156686Z","shell.execute_reply.started":"2022-07-15T10:19:43.031657Z","shell.execute_reply":"2022-07-15T10:19:43.155653Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(sklearn.metrics.accuracy_score(y_test,predictions))","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:19:43.158924Z","iopub.execute_input":"2022-07-15T10:19:43.159595Z","iopub.status.idle":"2022-07-15T10:19:43.166314Z","shell.execute_reply.started":"2022-07-15T10:19:43.159546Z","shell.execute_reply":"2022-07-15T10:19:43.165328Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Support Vector Machines (SVM)","metadata":{}},{"cell_type":"code","source":"pipeline=Pipeline(steps=[(\"model\",SVC())])","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:20:38.207449Z","iopub.execute_input":"2022-07-15T10:20:38.207865Z","iopub.status.idle":"2022-07-15T10:20:38.213199Z","shell.execute_reply.started":"2022-07-15T10:20:38.207829Z","shell.execute_reply":"2022-07-15T10:20:38.212040Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"kernel = ['poly', 'rbf', 'sigmoid']\nC = [50, 10, 1.0, 0.1, 0.01]\ngamma = ['scale']\ngrid = {\"model__kernel\":kernel,\"model__C\":C,\"model__gamma\":gamma}\n\nsearchCV = GridSearchCV(pipeline, cv=5, param_grid=grid)\nsearchCV.fit(X_train, y_train)  ","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:20:38.296203Z","iopub.execute_input":"2022-07-15T10:20:38.297285Z","iopub.status.idle":"2022-07-15T10:20:46.371831Z","shell.execute_reply.started":"2022-07-15T10:20:38.297250Z","shell.execute_reply":"2022-07-15T10:20:46.370874Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"searchCV.best_params_","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:20:56.025929Z","iopub.execute_input":"2022-07-15T10:20:56.026405Z","iopub.status.idle":"2022-07-15T10:20:56.033752Z","shell.execute_reply.started":"2022-07-15T10:20:56.026339Z","shell.execute_reply":"2022-07-15T10:20:56.032637Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions=searchCV.predict(X_test)\nprint(sklearn.metrics.classification_report(y_test, predictions))","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:21:01.975964Z","iopub.execute_input":"2022-07-15T10:21:01.976398Z","iopub.status.idle":"2022-07-15T10:21:02.088566Z","shell.execute_reply.started":"2022-07-15T10:21:01.976349Z","shell.execute_reply":"2022-07-15T10:21:02.087454Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(sklearn.metrics.accuracy_score(y_test,predictions))","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:21:11.084352Z","iopub.execute_input":"2022-07-15T10:21:11.085248Z","iopub.status.idle":"2022-07-15T10:21:11.090776Z","shell.execute_reply.started":"2022-07-15T10:21:11.085203Z","shell.execute_reply":"2022-07-15T10:21:11.090032Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Random Forest Classifier","metadata":{}},{"cell_type":"code","source":"pipeline=Pipeline(steps=[(\"model\",RandomForestClassifier())])","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:23:54.254342Z","iopub.execute_input":"2022-07-15T10:23:54.254804Z","iopub.status.idle":"2022-07-15T10:23:54.260163Z","shell.execute_reply.started":"2022-07-15T10:23:54.254771Z","shell.execute_reply":"2022-07-15T10:23:54.259019Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"n_estimators = [10, 100, 1000,2500,5000]\nmax_features = ['sqrt', 'log2']\n# define grid search\ngrid = {\"model__n_estimators\":n_estimators,\"model__max_features\":max_features}\n\nsearchCV = GridSearchCV(pipeline, cv=5, param_grid=grid)\nsearchCV.fit(X_train, y_train)  ","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:31:29.317974Z","iopub.execute_input":"2022-07-15T10:31:29.318425Z","iopub.status.idle":"2022-07-15T10:35:49.608133Z","shell.execute_reply.started":"2022-07-15T10:31:29.318365Z","shell.execute_reply":"2022-07-15T10:35:49.607203Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"searchCV.best_params_","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:36:52.280354Z","iopub.execute_input":"2022-07-15T10:36:52.281261Z","iopub.status.idle":"2022-07-15T10:36:52.286884Z","shell.execute_reply.started":"2022-07-15T10:36:52.281221Z","shell.execute_reply":"2022-07-15T10:36:52.286248Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions=searchCV.predict(X_test)\nprint(sklearn.metrics.classification_report(y_test, predictions))","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:36:53.463858Z","iopub.execute_input":"2022-07-15T10:36:53.464637Z","iopub.status.idle":"2022-07-15T10:36:53.505402Z","shell.execute_reply.started":"2022-07-15T10:36:53.464598Z","shell.execute_reply":"2022-07-15T10:36:53.504657Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(sklearn.metrics.accuracy_score(y_test,predictions))","metadata":{"execution":{"iopub.status.busy":"2022-07-15T10:36:55.819900Z","iopub.execute_input":"2022-07-15T10:36:55.820786Z","iopub.status.idle":"2022-07-15T10:36:55.826219Z","shell.execute_reply.started":"2022-07-15T10:36:55.820748Z","shell.execute_reply":"2022-07-15T10:36:55.825279Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Conclusion\n### Since it involves Binary classification, a lot of binary classifiers are compared. \n### GridSearchCV is used for the finding the best parameters for each classifier. \n### Accuracy score and classification report is presented and shown for each classifier","metadata":{}}]}