diff --git "a/P1M2_devin_lee.ipynb" "b/P1M2_devin_lee.ipynb" new file mode 100644--- /dev/null +++ "b/P1M2_devin_lee.ipynb" @@ -0,0 +1,4506 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## **1. Perkenalan**\n", + "---\n", + "**MILESTONE 2** \n", + "**Nama** : Devin Lee \n", + "**Batch** : HCK-009 \n", + "**Dataset** : E-Commerce Shipping Data \n", + "**Objective** : \n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## **2. Import Libraries**\n", + "---" + ] + }, + { + "cell_type": "code", + "execution_count": 257, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "from numpy import mean, median\n", + "import matplotlib.pyplot as plt\n", + "import seaborn as sns\n", + "from sklearn.model_selection import train_test_split, GridSearchCV, cross_val_score\n", + "from sklearn.preprocessing import StandardScaler, OrdinalEncoder, OneHotEncoder\n", + "from sklearn.metrics import classification_report, confusion_matrix, ConfusionMatrixDisplay, precision_score, f1_score\n", + "from sklearn.compose import make_column_transformer\n", + "from feature_engine.outliers import Winsorizer\n", + "from sklearn.svm import SVC\n", + "from sklearn.neighbors import KNeighborsClassifier\n", + "from sklearn.tree import DecisionTreeClassifier\n", + "from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier\n", + "from time import time\n", + "import warnings\n", + "import pickle\n", + "from sklearn.pipeline import Pipeline,make_pipeline" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## **3. Data Loading**\n", + "---" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "***Data Contains :***\n", + "- ***ID*** : ID Number of Customers.\n", + "- ***Warehouse block*** : The Company have big Warehouse which is divided in to block such as A,B,C,D,E.\n", + "- ***Mode of shipment*** : The Company Ships the products in multiple way such as Ship, Flight and Road.\n", + "- ***Customer care calls*** : The number of calls made from enquiry for enquiry of the shipment.\n", + "- ***Customer rating*** : The company has rated from every customer. 1 is the lowest (Worst), 5 is the highest (Best).\n", + "- ***Cost of the product*** : Cost of the Product in US Dollars.\n", + "- ***Prior purchases*** : The Number of Prior Purchase.\n", + "- ***Product importance*** : The company has categorized the product in the various parameter such as low, medium, high.\n", + "Gender : Male and Female.\n", + "- ***Discount offered*** : Discount offered on that specific product.\n", + "- ***Weight in gms*** : It is the weight in grams.\n", + "- ***Reached on time*** : It is the target variable, where 1 Indicates that the product has NOT reached on time and 0 indicates it has reached on time.*" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "***Loading Data:***\n", + "> Pada proses ini akan melakukan loading data menggunakan fungsi dari pandas. Dimana yang akan dilakukan adalah untuk melakukan read_csv karena dataset memiliki format csv. " + ] + }, + { + "cell_type": "code", + "execution_count": 179, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + " | ID | \n", + "Warehouse_block | \n", + "Mode_of_Shipment | \n", + "Customer_care_calls | \n", + "Customer_rating | \n", + "Cost_of_the_Product | \n", + "Prior_purchases | \n", + "Product_importance | \n", + "Gender | \n", + "Discount_offered | \n", + "Weight_in_gms | \n", + "Reached.on.Time_Y.N | \n", + "
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", + "1 | \n", + "D | \n", + "Flight | \n", + "4 | \n", + "2 | \n", + "177 | \n", + "3 | \n", + "low | \n", + "F | \n", + "44 | \n", + "1233 | \n", + "1 | \n", + "
1 | \n", + "2 | \n", + "F | \n", + "Flight | \n", + "4 | \n", + "5 | \n", + "216 | \n", + "2 | \n", + "low | \n", + "M | \n", + "59 | \n", + "3088 | \n", + "1 | \n", + "
2 | \n", + "3 | \n", + "A | \n", + "Flight | \n", + "2 | \n", + "2 | \n", + "183 | \n", + "4 | \n", + "low | \n", + "M | \n", + "48 | \n", + "3374 | \n", + "1 | \n", + "
3 | \n", + "4 | \n", + "B | \n", + "Flight | \n", + "3 | \n", + "3 | \n", + "176 | \n", + "4 | \n", + "medium | \n", + "M | \n", + "10 | \n", + "1177 | \n", + "1 | \n", + "
4 | \n", + "5 | \n", + "C | \n", + "Flight | \n", + "2 | \n", + "2 | \n", + "184 | \n", + "3 | \n", + "medium | \n", + "F | \n", + "46 | \n", + "2484 | \n", + "1 | \n", + "
... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "
10994 | \n", + "10995 | \n", + "A | \n", + "Ship | \n", + "4 | \n", + "1 | \n", + "252 | \n", + "5 | \n", + "medium | \n", + "F | \n", + "1 | \n", + "1538 | \n", + "1 | \n", + "
10995 | \n", + "10996 | \n", + "B | \n", + "Ship | \n", + "4 | \n", + "1 | \n", + "232 | \n", + "5 | \n", + "medium | \n", + "F | \n", + "6 | \n", + "1247 | \n", + "0 | \n", + "
10996 | \n", + "10997 | \n", + "C | \n", + "Ship | \n", + "5 | \n", + "4 | \n", + "242 | \n", + "5 | \n", + "low | \n", + "F | \n", + "4 | \n", + "1155 | \n", + "0 | \n", + "
10997 | \n", + "10998 | \n", + "F | \n", + "Ship | \n", + "5 | \n", + "2 | \n", + "223 | \n", + "6 | \n", + "medium | \n", + "M | \n", + "2 | \n", + "1210 | \n", + "0 | \n", + "
10998 | \n", + "10999 | \n", + "D | \n", + "Ship | \n", + "2 | \n", + "5 | \n", + "155 | \n", + "5 | \n", + "low | \n", + "F | \n", + "6 | \n", + "1639 | \n", + "0 | \n", + "
10999 rows × 12 columns
\n", + "\n", + " | count | \n", + "mean | \n", + "std | \n", + "min | \n", + "25% | \n", + "50% | \n", + "75% | \n", + "max | \n", + "
---|---|---|---|---|---|---|---|---|
id | \n", + "10999.0 | \n", + "5500.000000 | \n", + "3175.282140 | \n", + "1.0 | \n", + "2750.5 | \n", + "5500.0 | \n", + "8249.5 | \n", + "10999.0 | \n", + "
customer_care_calls | \n", + "10999.0 | \n", + "4.054459 | \n", + "1.141490 | \n", + "2.0 | \n", + "3.0 | \n", + "4.0 | \n", + "5.0 | \n", + "7.0 | \n", + "
customer_rating | \n", + "10999.0 | \n", + "2.990545 | \n", + "1.413603 | \n", + "1.0 | \n", + "2.0 | \n", + "3.0 | \n", + "4.0 | \n", + "5.0 | \n", + "
cost_of_the_product | \n", + "10999.0 | \n", + "210.196836 | \n", + "48.063272 | \n", + "96.0 | \n", + "169.0 | \n", + "214.0 | \n", + "251.0 | \n", + "310.0 | \n", + "
prior_purchases | \n", + "10999.0 | \n", + "3.567597 | \n", + "1.522860 | \n", + "2.0 | \n", + "3.0 | \n", + "3.0 | \n", + "4.0 | \n", + "10.0 | \n", + "
discount_offered | \n", + "10999.0 | \n", + "13.373216 | \n", + "16.205527 | \n", + "1.0 | \n", + "4.0 | \n", + "7.0 | \n", + "10.0 | \n", + "65.0 | \n", + "
weight_in_gms | \n", + "10999.0 | \n", + "3634.016729 | \n", + "1635.377251 | \n", + "1001.0 | \n", + "1839.5 | \n", + "4149.0 | \n", + "5050.0 | \n", + "7846.0 | \n", + "
reached.on.time_y.n | \n", + "10999.0 | \n", + "0.596691 | \n", + "0.490584 | \n", + "0.0 | \n", + "0.0 | \n", + "1.0 | \n", + "1.0 | \n", + "1.0 | \n", + "
\n", + " | warehouse_block | \n", + "mode_of_shipment | \n", + "customer_care_calls | \n", + "customer_rating | \n", + "cost_of_the_product | \n", + "prior_purchases | \n", + "product_importance | \n", + "gender | \n", + "discount_offered | \n", + "weight_in_gms | \n", + "
---|---|---|---|---|---|---|---|---|---|---|
0 | \n", + "D | \n", + "Flight | \n", + "4 | \n", + "2 | \n", + "177 | \n", + "3 | \n", + "low | \n", + "F | \n", + "44 | \n", + "1233 | \n", + "
1 | \n", + "E | \n", + "Flight | \n", + "4 | \n", + "5 | \n", + "216 | \n", + "2 | \n", + "low | \n", + "M | \n", + "59 | \n", + "3088 | \n", + "
2 | \n", + "A | \n", + "Flight | \n", + "2 | \n", + "2 | \n", + "183 | \n", + "4 | \n", + "low | \n", + "M | \n", + "48 | \n", + "3374 | \n", + "
3 | \n", + "B | \n", + "Flight | \n", + "3 | \n", + "3 | \n", + "176 | \n", + "4 | \n", + "medium | \n", + "M | \n", + "10 | \n", + "1177 | \n", + "
4 | \n", + "C | \n", + "Flight | \n", + "2 | \n", + "2 | \n", + "184 | \n", + "3 | \n", + "medium | \n", + "F | \n", + "46 | \n", + "2484 | \n", + "
\n", + " | warehouse_block | \n", + "mode_of_shipment | \n", + "customer_care_calls | \n", + "customer_rating | \n", + "cost_of_the_product | \n", + "prior_purchases | \n", + "product_importance | \n", + "gender | \n", + "discount_offered | \n", + "weight_in_gms | \n", + "
---|---|---|---|---|---|---|---|---|---|---|
2240 | \n", + "A | \n", + "Ship | \n", + "3 | \n", + "3 | \n", + "168 | \n", + "3 | \n", + "medium | \n", + "M | \n", + "11 | \n", + "1008 | \n", + "
4558 | \n", + "C | \n", + "Ship | \n", + "5 | \n", + "1 | \n", + "252 | \n", + "4 | \n", + "medium | \n", + "M | \n", + "4 | \n", + "1837 | \n", + "
10791 | \n", + "B | \n", + "Ship | \n", + "4 | \n", + "2 | \n", + "259 | \n", + "5 | \n", + "medium | \n", + "M | \n", + "7 | \n", + "1042 | \n", + "
4310 | \n", + "A | \n", + "Ship | \n", + "6 | \n", + "2 | \n", + "246 | \n", + "6 | \n", + "low | \n", + "F | \n", + "1 | \n", + "4846 | \n", + "
5211 | \n", + "B | \n", + "Flight | \n", + "3 | \n", + "2 | \n", + "160 | \n", + "3 | \n", + "medium | \n", + "M | \n", + "3 | \n", + "5807 | \n", + "
... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "
7526 | \n", + "A | \n", + "Road | \n", + "3 | \n", + "3 | \n", + "157 | \n", + "3 | \n", + "low | \n", + "F | \n", + "6 | \n", + "5187 | \n", + "
6471 | \n", + "B | \n", + "Ship | \n", + "4 | \n", + "4 | \n", + "266 | \n", + "3 | \n", + "low | \n", + "M | \n", + "3 | \n", + "5531 | \n", + "
2454 | \n", + "D | \n", + "Road | \n", + "4 | \n", + "5 | \n", + "219 | \n", + "2 | \n", + "medium | \n", + "F | \n", + "28 | \n", + "2164 | \n", + "
9484 | \n", + "C | \n", + "Ship | \n", + "3 | \n", + "5 | \n", + "218 | \n", + "2 | \n", + "medium | \n", + "F | \n", + "6 | \n", + "4072 | \n", + "
2667 | \n", + "B | \n", + "Ship | \n", + "5 | \n", + "3 | \n", + "162 | \n", + "4 | \n", + "medium | \n", + "M | \n", + "38 | \n", + "1407 | \n", + "
8799 rows × 10 columns
\n", + "\n", + " | warehouse_block | \n", + "mode_of_shipment | \n", + "customer_care_calls | \n", + "customer_rating | \n", + "cost_of_the_product | \n", + "prior_purchases | \n", + "product_importance | \n", + "gender | \n", + "discount_offered | \n", + "weight_in_gms | \n", + "
---|---|---|---|---|---|---|---|---|---|---|
2240 | \n", + "A | \n", + "Ship | \n", + "3 | \n", + "3 | \n", + "168 | \n", + "3.0 | \n", + "medium | \n", + "M | \n", + "11 | \n", + "1008 | \n", + "
4558 | \n", + "C | \n", + "Ship | \n", + "5 | \n", + "1 | \n", + "252 | \n", + "4.0 | \n", + "medium | \n", + "M | \n", + "4 | \n", + "1837 | \n", + "
10791 | \n", + "B | \n", + "Ship | \n", + "4 | \n", + "2 | \n", + "259 | \n", + "5.0 | \n", + "medium | \n", + "M | \n", + "7 | \n", + "1042 | \n", + "
4310 | \n", + "A | \n", + "Ship | \n", + "6 | \n", + "2 | \n", + "246 | \n", + "5.5 | \n", + "low | \n", + "F | \n", + "1 | \n", + "4846 | \n", + "
5211 | \n", + "B | \n", + "Flight | \n", + "3 | \n", + "2 | \n", + "160 | \n", + "3.0 | \n", + "medium | \n", + "M | \n", + "3 | \n", + "5807 | \n", + "
... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "... | \n", + "
7526 | \n", + "A | \n", + "Road | \n", + "3 | \n", + "3 | \n", + "157 | \n", + "3.0 | \n", + "low | \n", + "F | \n", + "6 | \n", + "5187 | \n", + "
6471 | \n", + "B | \n", + "Ship | \n", + "4 | \n", + "4 | \n", + "266 | \n", + "3.0 | \n", + "low | \n", + "M | \n", + "3 | \n", + "5531 | \n", + "
2454 | \n", + "D | \n", + "Road | \n", + "4 | \n", + "5 | \n", + "219 | \n", + "2.0 | \n", + "medium | \n", + "F | \n", + "19 | \n", + "2164 | \n", + "
9484 | \n", + "C | \n", + "Ship | \n", + "3 | \n", + "5 | \n", + "218 | \n", + "2.0 | \n", + "medium | \n", + "F | \n", + "6 | \n", + "4072 | \n", + "
2667 | \n", + "B | \n", + "Ship | \n", + "5 | \n", + "3 | \n", + "162 | \n", + "4.0 | \n", + "medium | \n", + "M | \n", + "19 | \n", + "1407 | \n", + "
8799 rows × 10 columns
\n", + "Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('kneighborsclassifier', KNeighborsClassifier(n_jobs=-1))])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('kneighborsclassifier', KNeighborsClassifier(n_jobs=-1))])
ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler', StandardScaler(),\n", + " ['customer_care_calls', 'customer_rating',\n", + " 'cost_of_the_product', 'prior_purchases',\n", + " 'discount_offered', 'weight_in_gms']),\n", + " ('ordinalencoder', OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder', OneHotEncoder(),\n", + " ['warehouse_block', 'mode_of_shipment',\n", + " 'gender'])])
['customer_care_calls', 'customer_rating', 'cost_of_the_product', 'prior_purchases', 'discount_offered', 'weight_in_gms']
StandardScaler()
['product_importance']
OrdinalEncoder()
['warehouse_block', 'mode_of_shipment', 'gender']
OneHotEncoder()
[]
passthrough
KNeighborsClassifier(n_jobs=-1)
Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('svc', SVC(random_state=42))])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('svc', SVC(random_state=42))])
ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler', StandardScaler(),\n", + " ['customer_care_calls', 'customer_rating',\n", + " 'cost_of_the_product', 'prior_purchases',\n", + " 'discount_offered', 'weight_in_gms']),\n", + " ('ordinalencoder', OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder', OneHotEncoder(),\n", + " ['warehouse_block', 'mode_of_shipment',\n", + " 'gender'])])
['customer_care_calls', 'customer_rating', 'cost_of_the_product', 'prior_purchases', 'discount_offered', 'weight_in_gms']
StandardScaler()
['product_importance']
OrdinalEncoder()
['warehouse_block', 'mode_of_shipment', 'gender']
OneHotEncoder()
[]
passthrough
SVC(random_state=42)
Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('decisiontreeclassifier',\n", + " DecisionTreeClassifier(criterion='entropy', max_depth=3,\n", + " min_samples_leaf=2, min_samples_split=5,\n", + " random_state=42))])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('decisiontreeclassifier',\n", + " DecisionTreeClassifier(criterion='entropy', max_depth=3,\n", + " min_samples_leaf=2, min_samples_split=5,\n", + " random_state=42))])
ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler', StandardScaler(),\n", + " ['customer_care_calls', 'customer_rating',\n", + " 'cost_of_the_product', 'prior_purchases',\n", + " 'discount_offered', 'weight_in_gms']),\n", + " ('ordinalencoder', OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder', OneHotEncoder(),\n", + " ['warehouse_block', 'mode_of_shipment',\n", + " 'gender'])])
['customer_care_calls', 'customer_rating', 'cost_of_the_product', 'prior_purchases', 'discount_offered', 'weight_in_gms']
StandardScaler()
['product_importance']
OrdinalEncoder()
['warehouse_block', 'mode_of_shipment', 'gender']
OneHotEncoder()
[]
passthrough
DecisionTreeClassifier(criterion='entropy', max_depth=3, min_samples_leaf=2,\n", + " min_samples_split=5, random_state=42)
Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('randomforestclassifier',\n", + " RandomForestClassifier(max_depth=5, min_samples_leaf=2,\n", + " min_samples_split=5, n_jobs=-1,\n", + " random_state=42))])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('randomforestclassifier',\n", + " RandomForestClassifier(max_depth=5, min_samples_leaf=2,\n", + " min_samples_split=5, n_jobs=-1,\n", + " random_state=42))])
ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler', StandardScaler(),\n", + " ['customer_care_calls', 'customer_rating',\n", + " 'cost_of_the_product', 'prior_purchases',\n", + " 'discount_offered', 'weight_in_gms']),\n", + " ('ordinalencoder', OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder', OneHotEncoder(),\n", + " ['warehouse_block', 'mode_of_shipment',\n", + " 'gender'])])
['customer_care_calls', 'customer_rating', 'cost_of_the_product', 'prior_purchases', 'discount_offered', 'weight_in_gms']
StandardScaler()
['product_importance']
OrdinalEncoder()
['warehouse_block', 'mode_of_shipment', 'gender']
OneHotEncoder()
[]
passthrough
RandomForestClassifier(max_depth=5, min_samples_leaf=2, min_samples_split=5,\n", + " n_jobs=-1, random_state=42)
GridSearchCV(cv=50,\n", + " estimator=Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder'...\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('kneighborsclassifier',\n", + " KNeighborsClassifier(n_jobs=-1))]),\n", + " n_jobs=-1,\n", + " param_grid={'kneighborsclassifier__metric': ['euclidean',\n", + " 'manhattan'],\n", + " 'kneighborsclassifier__n_neighbors': [1, 2, 3, 4, 5, 6,\n", + " 7, 8, 9, 10, 11,\n", + " 12, 13, 14, 15,\n", + " 16, 17, 18, 19,\n", + " 20, 21, 22, 23,\n", + " 24, 25, 26, 27,\n", + " 28, 29, 30],\n", + " 'kneighborsclassifier__weights': ['uniform',\n", + " 'distance']},\n", + " scoring='precision')In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
GridSearchCV(cv=50,\n", + " estimator=Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder'...\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('kneighborsclassifier',\n", + " KNeighborsClassifier(n_jobs=-1))]),\n", + " n_jobs=-1,\n", + " param_grid={'kneighborsclassifier__metric': ['euclidean',\n", + " 'manhattan'],\n", + " 'kneighborsclassifier__n_neighbors': [1, 2, 3, 4, 5, 6,\n", + " 7, 8, 9, 10, 11,\n", + " 12, 13, 14, 15,\n", + " 16, 17, 18, 19,\n", + " 20, 21, 22, 23,\n", + " 24, 25, 26, 27,\n", + " 28, 29, 30],\n", + " 'kneighborsclassifier__weights': ['uniform',\n", + " 'distance']},\n", + " scoring='precision')
Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('kneighborsclassifier', KNeighborsClassifier(n_jobs=-1))])
ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler', StandardScaler(),\n", + " ['customer_care_calls', 'customer_rating',\n", + " 'cost_of_the_product', 'prior_purchases',\n", + " 'discount_offered', 'weight_in_gms']),\n", + " ('ordinalencoder', OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder', OneHotEncoder(),\n", + " ['warehouse_block', 'mode_of_shipment',\n", + " 'gender'])])
['customer_care_calls', 'customer_rating', 'cost_of_the_product', 'prior_purchases', 'discount_offered', 'weight_in_gms']
StandardScaler()
['product_importance']
OrdinalEncoder()
['warehouse_block', 'mode_of_shipment', 'gender']
OneHotEncoder()
[]
passthrough
KNeighborsClassifier(n_jobs=-1)
GridSearchCV(cv=5,\n", + " estimator=Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('svc', SVC(random_state=42))]),\n", + " n_jobs=-1,\n", + " param_grid={'svc__C': [0.1, 1, 10, 100],\n", + " 'svc__gamma': ['scale', 'auto'],\n", + " 'svc__kernel': ['linear', 'rbf', 'poly']},\n", + " scoring='precision', verbose=1)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
GridSearchCV(cv=5,\n", + " estimator=Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('svc', SVC(random_state=42))]),\n", + " n_jobs=-1,\n", + " param_grid={'svc__C': [0.1, 1, 10, 100],\n", + " 'svc__gamma': ['scale', 'auto'],\n", + " 'svc__kernel': ['linear', 'rbf', 'poly']},\n", + " scoring='precision', verbose=1)
Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('svc', SVC(random_state=42))])
ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler', StandardScaler(),\n", + " ['customer_care_calls', 'customer_rating',\n", + " 'cost_of_the_product', 'prior_purchases',\n", + " 'discount_offered', 'weight_in_gms']),\n", + " ('ordinalencoder', OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder', OneHotEncoder(),\n", + " ['warehouse_block', 'mode_of_shipment',\n", + " 'gender'])])
['customer_care_calls', 'customer_rating', 'cost_of_the_product', 'prior_purchases', 'discount_offered', 'weight_in_gms']
StandardScaler()
['product_importance']
OrdinalEncoder()
['warehouse_block', 'mode_of_shipment', 'gender']
OneHotEncoder()
[]
passthrough
SVC(random_state=42)
Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('svc', SVC(C=0.1, random_state=42))])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
Pipeline(steps=[('columntransformer',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('svc', SVC(C=0.1, random_state=42))])
ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler', StandardScaler(),\n", + " ['customer_care_calls', 'customer_rating',\n", + " 'cost_of_the_product', 'prior_purchases',\n", + " 'discount_offered', 'weight_in_gms']),\n", + " ('ordinalencoder', OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder', OneHotEncoder(),\n", + " ['warehouse_block', 'mode_of_shipment',\n", + " 'gender'])])
['customer_care_calls', 'customer_rating', 'cost_of_the_product', 'prior_purchases', 'discount_offered', 'weight_in_gms']
StandardScaler()
['product_importance']
OrdinalEncoder()
['warehouse_block', 'mode_of_shipment', 'gender']
OneHotEncoder()
[]
passthrough
SVC(C=0.1, random_state=42)
Pipeline(steps=[('preprocessor',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('ada_boost_svc',\n", + " AdaBoostClassifier(base_estimator=SVC(probability=True,\n", + " random_state=42),\n", + " n_estimators=5, random_state=42))])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
Pipeline(steps=[('preprocessor',\n", + " ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler',\n", + " StandardScaler(),\n", + " ['customer_care_calls',\n", + " 'customer_rating',\n", + " 'cost_of_the_product',\n", + " 'prior_purchases',\n", + " 'discount_offered',\n", + " 'weight_in_gms']),\n", + " ('ordinalencoder',\n", + " OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder',\n", + " OneHotEncoder(),\n", + " ['warehouse_block',\n", + " 'mode_of_shipment',\n", + " 'gender'])])),\n", + " ('ada_boost_svc',\n", + " AdaBoostClassifier(base_estimator=SVC(probability=True,\n", + " random_state=42),\n", + " n_estimators=5, random_state=42))])
ColumnTransformer(remainder='passthrough',\n", + " transformers=[('standardscaler', StandardScaler(),\n", + " ['customer_care_calls', 'customer_rating',\n", + " 'cost_of_the_product', 'prior_purchases',\n", + " 'discount_offered', 'weight_in_gms']),\n", + " ('ordinalencoder', OrdinalEncoder(),\n", + " ['product_importance']),\n", + " ('onehotencoder', OneHotEncoder(),\n", + " ['warehouse_block', 'mode_of_shipment',\n", + " 'gender'])])
['customer_care_calls', 'customer_rating', 'cost_of_the_product', 'prior_purchases', 'discount_offered', 'weight_in_gms']
StandardScaler()
['product_importance']
OrdinalEncoder()
['warehouse_block', 'mode_of_shipment', 'gender']
OneHotEncoder()
[]
passthrough
AdaBoostClassifier(base_estimator=SVC(probability=True, random_state=42),\n", + " n_estimators=5, random_state=42)
SVC(probability=True, random_state=42)
SVC(probability=True, random_state=42)