#important libraries
import numpy as np
import pandas as pd
importing wine quality data from UCI ML repo via wget
wget: helps to retrieves content from web servers
!wget --no-check-certificate \
https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-red.csv
--2020-08-04 05:15:12-- https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-red.csv Resolving archive.ics.uci.edu (archive.ics.uci.edu)... 128.195.10.252 Connecting to archive.ics.uci.edu (archive.ics.uci.edu)|128.195.10.252|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 84199 (82K) [application/x-httpd-php] Saving to: ‘winequality-red.csv’ winequality-red.csv 100%[===================>] 82.23K --.-KB/s in 0.05s 2020-08-04 05:15:12 (1.56 MB/s) - ‘winequality-red.csv’ saved [84199/84199]
df1 = pd.read_csv('/kaggle/working/winequality-red.csv', sep=";")
df1.head()
fixed acidity | volatile acidity | citric acid | residual sugar | chlorides | free sulfur dioxide | total sulfur dioxide | density | pH | sulphates | alcohol | quality | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 7.4 | 0.70 | 0.00 | 1.9 | 0.076 | 11.0 | 34.0 | 0.9978 | 3.51 | 0.56 | 9.4 | 5 |
1 | 7.8 | 0.88 | 0.00 | 2.6 | 0.098 | 25.0 | 67.0 | 0.9968 | 3.20 | 0.68 | 9.8 | 5 |
2 | 7.8 | 0.76 | 0.04 | 2.3 | 0.092 | 15.0 | 54.0 | 0.9970 | 3.26 | 0.65 | 9.8 | 5 |
3 | 11.2 | 0.28 | 0.56 | 1.9 | 0.075 | 17.0 | 60.0 | 0.9980 | 3.16 | 0.58 | 9.8 | 6 |
4 | 7.4 | 0.70 | 0.00 | 1.9 | 0.076 | 11.0 | 34.0 | 0.9978 | 3.51 | 0.56 | 9.4 | 5 |
df1.describe()
fixed acidity | volatile acidity | citric acid | residual sugar | chlorides | free sulfur dioxide | total sulfur dioxide | density | pH | sulphates | alcohol | quality | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
count | 1599.000000 | 1599.000000 | 1599.000000 | 1599.000000 | 1599.000000 | 1599.000000 | 1599.000000 | 1599.000000 | 1599.000000 | 1599.000000 | 1599.000000 | 1599.000000 |
mean | 8.319637 | 0.527821 | 0.270976 | 2.538806 | 0.087467 | 15.874922 | 46.467792 | 0.996747 | 3.311113 | 0.658149 | 10.422983 | 5.636023 |
std | 1.741096 | 0.179060 | 0.194801 | 1.409928 | 0.047065 | 10.460157 | 32.895324 | 0.001887 | 0.154386 | 0.169507 | 1.065668 | 0.807569 |
min | 4.600000 | 0.120000 | 0.000000 | 0.900000 | 0.012000 | 1.000000 | 6.000000 | 0.990070 | 2.740000 | 0.330000 | 8.400000 | 3.000000 |
25% | 7.100000 | 0.390000 | 0.090000 | 1.900000 | 0.070000 | 7.000000 | 22.000000 | 0.995600 | 3.210000 | 0.550000 | 9.500000 | 5.000000 |
50% | 7.900000 | 0.520000 | 0.260000 | 2.200000 | 0.079000 | 14.000000 | 38.000000 | 0.996750 | 3.310000 | 0.620000 | 10.200000 | 6.000000 |
75% | 9.200000 | 0.640000 | 0.420000 | 2.600000 | 0.090000 | 21.000000 | 62.000000 | 0.997835 | 3.400000 | 0.730000 | 11.100000 | 6.000000 |
max | 15.900000 | 1.580000 | 1.000000 | 15.500000 | 0.611000 | 72.000000 | 289.000000 | 1.003690 | 4.010000 | 2.000000 | 14.900000 | 8.000000 |
you can see for yourself how imbalance the classes are, target quality for class 4,8,3 are negligible as compared to 5,6,7. This will surely impact the model performace on minority classes and introduce bias
df1.quality.value_counts()
5 681 6 638 7 199 4 53 8 18 3 10 Name: quality, dtype: int64
installing the latest version of PyCaret
pip install pycaret==2.0
Collecting pycaret==2.0
Downloading pycaret-2.0-py3-none-any.whl (255 kB)
|████████████████████████████████| 255 kB 575 kB/s eta 0:00:01
Requirement already satisfied: textblob in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (0.15.3)
Requirement already satisfied: seaborn in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (0.10.0)
Requirement already satisfied: gensim in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (3.8.3)
Collecting pyod
Downloading pyod-0.8.1.tar.gz (93 kB)
|████████████████████████████████| 93 kB 679 kB/s eta 0:00:011
Requirement already satisfied: lightgbm>=2.3.1 in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (2.3.1)
Requirement already satisfied: pyLDAvis in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (2.1.2)
Requirement already satisfied: kmodes>=0.10.1 in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (0.10.2)
Requirement already satisfied: imbalanced-learn in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (0.7.0)
Requirement already satisfied: pandas in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (1.0.3)
Requirement already satisfied: mlxtend in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (0.17.2)
Requirement already satisfied: IPython in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (7.13.0)
Collecting mlflow
Downloading mlflow-1.10.0-py3-none-any.whl (12.4 MB)
|████████████████████████████████| 12.4 MB 9.8 MB/s eta 0:00:01
Collecting DateTime>=4.3
Downloading DateTime-4.3-py2.py3-none-any.whl (60 kB)
|████████████████████████████████| 60 kB 4.4 MB/s eta 0:00:01
Requirement already satisfied: matplotlib in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (3.2.1)
Requirement already satisfied: wordcloud in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (1.7.0)
Requirement already satisfied: ipywidgets in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (7.5.1)
Collecting datefinder>=0.7.0
Downloading datefinder-0.7.1-py2.py3-none-any.whl (10 kB)
Requirement already satisfied: spacy in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (2.2.4)
Requirement already satisfied: plotly>=4.4.1 in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (4.9.0)
Requirement already satisfied: nltk in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (3.2.4)
Requirement already satisfied: joblib in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (0.14.1)
Requirement already satisfied: cufflinks>=0.17.0 in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (0.17.3)
Requirement already satisfied: yellowbrick>=1.0.1 in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (1.1)
Requirement already satisfied: scikit-learn>=0.23 in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (0.23.1)
Requirement already satisfied: xgboost>=0.90 in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (1.1.1)
Requirement already satisfied: pandas-profiling>=2.3.0 in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (2.6.0)
Requirement already satisfied: numpy>=1.17 in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (1.18.5)
Requirement already satisfied: catboost in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (0.23.2)
Requirement already satisfied: umap-learn in /opt/conda/lib/python3.7/site-packages (from pycaret==2.0) (0.3.10)
Requirement already satisfied: scipy>=1.0.1 in /opt/conda/lib/python3.7/site-packages (from seaborn->pycaret==2.0) (1.4.1)
Requirement already satisfied: six>=1.5.0 in /opt/conda/lib/python3.7/site-packages (from gensim->pycaret==2.0) (1.14.0)
Requirement already satisfied: smart-open>=1.8.1 in /opt/conda/lib/python3.7/site-packages (from gensim->pycaret==2.0) (2.1.0)
Collecting combo
Downloading combo-0.1.1.tar.gz (37 kB)
Requirement already satisfied: numba>=0.35 in /opt/conda/lib/python3.7/site-packages (from pyod->pycaret==2.0) (0.48.0)
Collecting suod
Downloading suod-0.0.4.tar.gz (2.1 MB)
|████████████████████████████████| 2.1 MB 20.5 MB/s eta 0:00:01
Requirement already satisfied: funcy in /opt/conda/lib/python3.7/site-packages (from pyLDAvis->pycaret==2.0) (1.14)
Requirement already satisfied: wheel>=0.23.0 in /opt/conda/lib/python3.7/site-packages (from pyLDAvis->pycaret==2.0) (0.34.2)
Requirement already satisfied: jinja2>=2.7.2 in /opt/conda/lib/python3.7/site-packages (from pyLDAvis->pycaret==2.0) (2.11.2)
Requirement already satisfied: pytest in /opt/conda/lib/python3.7/site-packages (from pyLDAvis->pycaret==2.0) (5.4.1)
Requirement already satisfied: future in /opt/conda/lib/python3.7/site-packages (from pyLDAvis->pycaret==2.0) (0.18.2)
Requirement already satisfied: numexpr in /opt/conda/lib/python3.7/site-packages (from pyLDAvis->pycaret==2.0) (2.7.1)
Requirement already satisfied: pytz>=2017.2 in /opt/conda/lib/python3.7/site-packages (from pandas->pycaret==2.0) (2019.3)
Requirement already satisfied: python-dateutil>=2.6.1 in /opt/conda/lib/python3.7/site-packages (from pandas->pycaret==2.0) (2.8.1)
Requirement already satisfied: setuptools in /opt/conda/lib/python3.7/site-packages (from mlxtend->pycaret==2.0) (46.1.3.post20200325)
Requirement already satisfied: decorator in /opt/conda/lib/python3.7/site-packages (from IPython->pycaret==2.0) (4.4.2)
Requirement already satisfied: pickleshare in /opt/conda/lib/python3.7/site-packages (from IPython->pycaret==2.0) (0.7.5)
Requirement already satisfied: jedi>=0.10 in /opt/conda/lib/python3.7/site-packages (from IPython->pycaret==2.0) (0.15.2)
Requirement already satisfied: pygments in /opt/conda/lib/python3.7/site-packages (from IPython->pycaret==2.0) (2.6.1)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.7/site-packages (from IPython->pycaret==2.0) (3.0.5)
Requirement already satisfied: pexpect; sys_platform != "win32" in /opt/conda/lib/python3.7/site-packages (from IPython->pycaret==2.0) (4.8.0)
Requirement already satisfied: traitlets>=4.2 in /opt/conda/lib/python3.7/site-packages (from IPython->pycaret==2.0) (4.3.3)
Requirement already satisfied: backcall in /opt/conda/lib/python3.7/site-packages (from IPython->pycaret==2.0) (0.1.0)
Requirement already satisfied: gitpython>=2.1.0 in /opt/conda/lib/python3.7/site-packages (from mlflow->pycaret==2.0) (3.1.1)
Collecting prometheus-flask-exporter
Downloading prometheus_flask_exporter-0.15.4.tar.gz (20 kB)
Requirement already satisfied: docker>=4.0.0 in /opt/conda/lib/python3.7/site-packages (from mlflow->pycaret==2.0) (4.2.0)
Requirement already satisfied: entrypoints in /opt/conda/lib/python3.7/site-packages (from mlflow->pycaret==2.0) (0.3)
Collecting databricks-cli>=0.8.7
Downloading databricks-cli-0.11.0.tar.gz (49 kB)
|████████████████████████████████| 49 kB 2.9 MB/s eta 0:00:01
Collecting azure-storage-blob>=12.0
Downloading azure_storage_blob-12.3.2-py2.py3-none-any.whl (280 kB)
|████████████████████████████████| 280 kB 18.2 MB/s eta 0:00:01
Collecting sqlalchemy<=1.3.13
Downloading SQLAlchemy-1.3.13.tar.gz (6.0 MB)
|████████████████████████████████| 6.0 MB 19.0 MB/s eta 0:00:01
Requirement already satisfied: cloudpickle in /opt/conda/lib/python3.7/site-packages (from mlflow->pycaret==2.0) (1.3.0)
Collecting querystring-parser
Downloading querystring_parser-1.2.4.tar.gz (5.5 kB)
Requirement already satisfied: protobuf>=3.6.0 in /opt/conda/lib/python3.7/site-packages (from mlflow->pycaret==2.0) (3.12.2)
Collecting gorilla
Downloading gorilla-0.3.0-py2.py3-none-any.whl (11 kB)
Requirement already satisfied: Flask in /opt/conda/lib/python3.7/site-packages (from mlflow->pycaret==2.0) (1.1.2)
Requirement already satisfied: sqlparse in /opt/conda/lib/python3.7/site-packages (from mlflow->pycaret==2.0) (0.3.1)
Requirement already satisfied: pyyaml in /opt/conda/lib/python3.7/site-packages (from mlflow->pycaret==2.0) (5.3.1)
Requirement already satisfied: requests>=2.17.3 in /opt/conda/lib/python3.7/site-packages (from mlflow->pycaret==2.0) (2.23.0)
Requirement already satisfied: click>=7.0 in /opt/conda/lib/python3.7/site-packages (from mlflow->pycaret==2.0) (7.1.1)
Collecting gunicorn; platform_system != "Windows"
Downloading gunicorn-20.0.4-py2.py3-none-any.whl (77 kB)
|████████████████████████████████| 77 kB 4.6 MB/s eta 0:00:01
Requirement already satisfied: alembic in /opt/conda/lib/python3.7/site-packages (from mlflow->pycaret==2.0) (1.4.2)
Collecting zope.interface
Downloading zope.interface-5.1.0-cp37-cp37m-manylinux2010_x86_64.whl (235 kB)
|████████████████████████████████| 235 kB 29.3 MB/s eta 0:00:01
Requirement already satisfied: cycler>=0.10 in /opt/conda/lib/python3.7/site-packages (from matplotlib->pycaret==2.0) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /opt/conda/lib/python3.7/site-packages (from matplotlib->pycaret==2.0) (2.4.7)
Requirement already satisfied: kiwisolver>=1.0.1 in /opt/conda/lib/python3.7/site-packages (from matplotlib->pycaret==2.0) (1.2.0)
Requirement already satisfied: pillow in /opt/conda/lib/python3.7/site-packages (from wordcloud->pycaret==2.0) (7.2.0)
Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.7/site-packages (from ipywidgets->pycaret==2.0) (5.1.1)
Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.7/site-packages (from ipywidgets->pycaret==2.0) (3.5.1)
Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.7/site-packages (from ipywidgets->pycaret==2.0) (5.0.6)
Requirement already satisfied: regex>=2017.02.08 in /opt/conda/lib/python3.7/site-packages (from datefinder>=0.7.0->pycaret==2.0) (2020.4.4)
Requirement already satisfied: thinc==7.4.0 in /opt/conda/lib/python3.7/site-packages (from spacy->pycaret==2.0) (7.4.0)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /opt/conda/lib/python3.7/site-packages (from spacy->pycaret==2.0) (1.0.2)
Requirement already satisfied: plac<1.2.0,>=0.9.6 in /opt/conda/lib/python3.7/site-packages (from spacy->pycaret==2.0) (1.1.3)
Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in /opt/conda/lib/python3.7/site-packages (from spacy->pycaret==2.0) (4.45.0)
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /opt/conda/lib/python3.7/site-packages (from spacy->pycaret==2.0) (3.0.2)
Requirement already satisfied: blis<0.5.0,>=0.4.0 in /opt/conda/lib/python3.7/site-packages (from spacy->pycaret==2.0) (0.4.1)
Requirement already satisfied: srsly<1.1.0,>=1.0.2 in /opt/conda/lib/python3.7/site-packages (from spacy->pycaret==2.0) (1.0.2)
Requirement already satisfied: wasabi<1.1.0,>=0.4.0 in /opt/conda/lib/python3.7/site-packages (from spacy->pycaret==2.0) (0.7.1)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /opt/conda/lib/python3.7/site-packages (from spacy->pycaret==2.0) (2.0.3)
Requirement already satisfied: catalogue<1.1.0,>=0.0.7 in /opt/conda/lib/python3.7/site-packages (from spacy->pycaret==2.0) (1.0.0)
Requirement already satisfied: retrying>=1.3.3 in /opt/conda/lib/python3.7/site-packages (from plotly>=4.4.1->pycaret==2.0) (1.3.3)
Requirement already satisfied: colorlover>=0.2.1 in /opt/conda/lib/python3.7/site-packages (from cufflinks>=0.17.0->pycaret==2.0) (0.3.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in /opt/conda/lib/python3.7/site-packages (from scikit-learn>=0.23->pycaret==2.0) (2.1.0)
Requirement already satisfied: phik>=0.9.10 in /opt/conda/lib/python3.7/site-packages (from pandas-profiling>=2.3.0->pycaret==2.0) (0.9.11)
Requirement already satisfied: confuse>=1.0.0 in /opt/conda/lib/python3.7/site-packages (from pandas-profiling>=2.3.0->pycaret==2.0) (1.1.0)
Requirement already satisfied: statsmodels>=0.11.1 in /opt/conda/lib/python3.7/site-packages (from pandas-profiling>=2.3.0->pycaret==2.0) (0.11.1)
Requirement already satisfied: missingno>=0.4.2 in /opt/conda/lib/python3.7/site-packages (from pandas-profiling>=2.3.0->pycaret==2.0) (0.4.2)
Requirement already satisfied: tangled-up-in-unicode>=0.0.4 in /opt/conda/lib/python3.7/site-packages (from pandas-profiling>=2.3.0->pycaret==2.0) (0.0.4)
Requirement already satisfied: htmlmin>=0.1.12 in /opt/conda/lib/python3.7/site-packages (from pandas-profiling>=2.3.0->pycaret==2.0) (0.1.12)
Requirement already satisfied: astropy>=4.0 in /opt/conda/lib/python3.7/site-packages (from pandas-profiling>=2.3.0->pycaret==2.0) (4.0.1.post1)
Requirement already satisfied: visions[type_image_path]>=0.4.1 in /opt/conda/lib/python3.7/site-packages (from pandas-profiling>=2.3.0->pycaret==2.0) (0.4.1)
Requirement already satisfied: graphviz in /opt/conda/lib/python3.7/site-packages (from catboost->pycaret==2.0) (0.8.4)
Requirement already satisfied: boto in /opt/conda/lib/python3.7/site-packages (from smart-open>=1.8.1->gensim->pycaret==2.0) (2.49.0)
Requirement already satisfied: boto3 in /opt/conda/lib/python3.7/site-packages (from smart-open>=1.8.1->gensim->pycaret==2.0) (1.14.28)
Requirement already satisfied: llvmlite<0.32.0,>=0.31.0dev0 in /opt/conda/lib/python3.7/site-packages (from numba>=0.35->pyod->pycaret==2.0) (0.31.0)
Requirement already satisfied: MarkupSafe>=0.23 in /opt/conda/lib/python3.7/site-packages (from jinja2>=2.7.2->pyLDAvis->pycaret==2.0) (1.1.1)
Requirement already satisfied: py>=1.5.0 in /opt/conda/lib/python3.7/site-packages (from pytest->pyLDAvis->pycaret==2.0) (1.8.1)
Requirement already satisfied: packaging in /opt/conda/lib/python3.7/site-packages (from pytest->pyLDAvis->pycaret==2.0) (20.1)
Requirement already satisfied: attrs>=17.4.0 in /opt/conda/lib/python3.7/site-packages (from pytest->pyLDAvis->pycaret==2.0) (19.3.0)
Requirement already satisfied: more-itertools>=4.0.0 in /opt/conda/lib/python3.7/site-packages (from pytest->pyLDAvis->pycaret==2.0) (8.2.0)
Requirement already satisfied: pluggy<1.0,>=0.12 in /opt/conda/lib/python3.7/site-packages (from pytest->pyLDAvis->pycaret==2.0) (0.13.0)
Requirement already satisfied: wcwidth in /opt/conda/lib/python3.7/site-packages (from pytest->pyLDAvis->pycaret==2.0) (0.1.9)
Requirement already satisfied: importlib-metadata>=0.12 in /opt/conda/lib/python3.7/site-packages (from pytest->pyLDAvis->pycaret==2.0) (1.7.0)
Requirement already satisfied: parso>=0.5.2 in /opt/conda/lib/python3.7/site-packages (from jedi>=0.10->IPython->pycaret==2.0) (0.5.2)
Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.7/site-packages (from pexpect; sys_platform != "win32"->IPython->pycaret==2.0) (0.6.0)
Requirement already satisfied: ipython-genutils in /opt/conda/lib/python3.7/site-packages (from traitlets>=4.2->IPython->pycaret==2.0) (0.2.0)
Requirement already satisfied: gitdb<5,>=4.0.1 in /opt/conda/lib/python3.7/site-packages (from gitpython>=2.1.0->mlflow->pycaret==2.0) (4.0.4)
Requirement already satisfied: prometheus_client in /opt/conda/lib/python3.7/site-packages (from prometheus-flask-exporter->mlflow->pycaret==2.0) (0.7.1)
Requirement already satisfied: websocket-client>=0.32.0 in /opt/conda/lib/python3.7/site-packages (from docker>=4.0.0->mlflow->pycaret==2.0) (0.57.0)
Requirement already satisfied: tabulate>=0.7.7 in /opt/conda/lib/python3.7/site-packages (from databricks-cli>=0.8.7->mlflow->pycaret==2.0) (0.8.7)
Collecting azure-core<2.0.0,>=1.6.0
Downloading azure_core-1.7.0-py2.py3-none-any.whl (121 kB)
|████████████████████████████████| 121 kB 28.3 MB/s eta 0:00:01
Requirement already satisfied: cryptography>=2.1.4 in /opt/conda/lib/python3.7/site-packages (from azure-storage-blob>=12.0->mlflow->pycaret==2.0) (2.8)
Collecting msrest>=0.6.10
Downloading msrest-0.6.18-py2.py3-none-any.whl (84 kB)
|████████████████████████████████| 84 kB 2.2 MB/s eta 0:00:01
Requirement already satisfied: itsdangerous>=0.24 in /opt/conda/lib/python3.7/site-packages (from Flask->mlflow->pycaret==2.0) (1.1.0)
Requirement already satisfied: Werkzeug>=0.15 in /opt/conda/lib/python3.7/site-packages (from Flask->mlflow->pycaret==2.0) (1.0.1)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /opt/conda/lib/python3.7/site-packages (from requests>=2.17.3->mlflow->pycaret==2.0) (1.24.3)
Requirement already satisfied: chardet<4,>=3.0.2 in /opt/conda/lib/python3.7/site-packages (from requests>=2.17.3->mlflow->pycaret==2.0) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /opt/conda/lib/python3.7/site-packages (from requests>=2.17.3->mlflow->pycaret==2.0) (2020.6.20)
Requirement already satisfied: idna<3,>=2.5 in /opt/conda/lib/python3.7/site-packages (from requests>=2.17.3->mlflow->pycaret==2.0) (2.9)
Requirement already satisfied: Mako in /opt/conda/lib/python3.7/site-packages (from alembic->mlflow->pycaret==2.0) (1.1.3)
Requirement already satisfied: python-editor>=0.3 in /opt/conda/lib/python3.7/site-packages (from alembic->mlflow->pycaret==2.0) (1.0.4)
Requirement already satisfied: tornado>=4.2 in /opt/conda/lib/python3.7/site-packages (from ipykernel>=4.5.1->ipywidgets->pycaret==2.0) (5.0.2)
Requirement already satisfied: jupyter-client in /opt/conda/lib/python3.7/site-packages (from ipykernel>=4.5.1->ipywidgets->pycaret==2.0) (6.1.3)
Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.7/site-packages (from widgetsnbextension~=3.5.0->ipywidgets->pycaret==2.0) (5.5.0)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.7/site-packages (from nbformat>=4.2.0->ipywidgets->pycaret==2.0) (3.2.0)
Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.7/site-packages (from nbformat>=4.2.0->ipywidgets->pycaret==2.0) (4.6.3)
Requirement already satisfied: patsy>=0.5 in /opt/conda/lib/python3.7/site-packages (from statsmodels>=0.11.1->pandas-profiling>=2.3.0->pycaret==2.0) (0.5.1)
Requirement already satisfied: networkx>=2.4 in /opt/conda/lib/python3.7/site-packages (from visions[type_image_path]>=0.4.1->pandas-profiling>=2.3.0->pycaret==2.0) (2.4)
Requirement already satisfied: imagehash; extra == "type_image_path" in /opt/conda/lib/python3.7/site-packages (from visions[type_image_path]>=0.4.1->pandas-profiling>=2.3.0->pycaret==2.0) (4.1.0)
Requirement already satisfied: s3transfer<0.4.0,>=0.3.0 in /opt/conda/lib/python3.7/site-packages (from boto3->smart-open>=1.8.1->gensim->pycaret==2.0) (0.3.3)
Requirement already satisfied: botocore<1.18.0,>=1.17.28 in /opt/conda/lib/python3.7/site-packages (from boto3->smart-open>=1.8.1->gensim->pycaret==2.0) (1.17.28)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /opt/conda/lib/python3.7/site-packages (from boto3->smart-open>=1.8.1->gensim->pycaret==2.0) (0.10.0)
Requirement already satisfied: zipp>=0.5 in /opt/conda/lib/python3.7/site-packages (from importlib-metadata>=0.12->pytest->pyLDAvis->pycaret==2.0) (3.1.0)
Requirement already satisfied: smmap<4,>=3.0.1 in /opt/conda/lib/python3.7/site-packages (from gitdb<5,>=4.0.1->gitpython>=2.1.0->mlflow->pycaret==2.0) (3.0.2)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in /opt/conda/lib/python3.7/site-packages (from cryptography>=2.1.4->azure-storage-blob>=12.0->mlflow->pycaret==2.0) (1.14.0)
Collecting isodate>=0.6.0
Downloading isodate-0.6.0-py2.py3-none-any.whl (45 kB)
|████████████████████████████████| 45 kB 1.9 MB/s eta 0:00:01
Requirement already satisfied: requests-oauthlib>=0.5.0 in /opt/conda/lib/python3.7/site-packages (from msrest>=0.6.10->azure-storage-blob>=12.0->mlflow->pycaret==2.0) (1.2.0)
Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.7/site-packages (from jupyter-client->ipykernel>=4.5.1->ipywidgets->pycaret==2.0) (19.0.0)
Requirement already satisfied: terminado>=0.8.1 in /opt/conda/lib/python3.7/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret==2.0) (0.8.3)
Requirement already satisfied: nbconvert in /opt/conda/lib/python3.7/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret==2.0) (5.6.1)
Requirement already satisfied: Send2Trash in /opt/conda/lib/python3.7/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret==2.0) (1.5.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /opt/conda/lib/python3.7/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->pycaret==2.0) (0.16.0)
Requirement already satisfied: PyWavelets in /opt/conda/lib/python3.7/site-packages (from imagehash; extra == "type_image_path"->visions[type_image_path]>=0.4.1->pandas-profiling>=2.3.0->pycaret==2.0) (1.1.1)
Requirement already satisfied: docutils<0.16,>=0.10 in /opt/conda/lib/python3.7/site-packages (from botocore<1.18.0,>=1.17.28->boto3->smart-open>=1.8.1->gensim->pycaret==2.0) (0.15.2)
Requirement already satisfied: pycparser in /opt/conda/lib/python3.7/site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.1.4->azure-storage-blob>=12.0->mlflow->pycaret==2.0) (2.20)
Requirement already satisfied: oauthlib>=3.0.0 in /opt/conda/lib/python3.7/site-packages (from requests-oauthlib>=0.5.0->msrest>=0.6.10->azure-storage-blob>=12.0->mlflow->pycaret==2.0) (3.0.1)
Requirement already satisfied: testpath in /opt/conda/lib/python3.7/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret==2.0) (0.4.4)
Requirement already satisfied: bleach in /opt/conda/lib/python3.7/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret==2.0) (3.1.4)
Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.7/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret==2.0) (1.4.2)
Requirement already satisfied: defusedxml in /opt/conda/lib/python3.7/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret==2.0) (0.6.0)
Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.7/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret==2.0) (0.8.4)
Requirement already satisfied: webencodings in /opt/conda/lib/python3.7/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets->pycaret==2.0) (0.5.1)
Building wheels for collected packages: pyod, combo, suod, prometheus-flask-exporter, databricks-cli, sqlalchemy, querystring-parser
Building wheel for pyod (setup.py) ... done
Created wheel for pyod: filename=pyod-0.8.1-py3-none-any.whl size=105651 sha256=468e9f3ee1062549c477b9f21277cad5c791a13f8c83483e5dfa71ffdf7e1bb9
Stored in directory: /root/.cache/pip/wheels/d6/f2/24/2c050361bd259bee34bbef8047bbcd3f08085f2a8a5ed1fc85
Building wheel for combo (setup.py) ... done
Created wheel for combo: filename=combo-0.1.1-py3-none-any.whl size=42113 sha256=5dfd021545feb373b65924cbb8ce1bb21698bf140f6f6d043d3d845363b4dfc0
Stored in directory: /root/.cache/pip/wheels/3e/e1/f8/08f19ba48f75d3dbbb549cec4b86cc0392c14b2b6bb81f4e1f
Building wheel for suod (setup.py) ... done
Created wheel for suod: filename=suod-0.0.4-py3-none-any.whl size=2167157 sha256=678eb1a2c80c149fdbff47afb8baeba674428dcea668949d4cc4c4d64bbc4279
Stored in directory: /root/.cache/pip/wheels/dc/ae/aa/3b8cc857617f3ba6cb9e6b804c79c69d0ed60a08e022e9a4f3
Building wheel for prometheus-flask-exporter (setup.py) ... done
Created wheel for prometheus-flask-exporter: filename=prometheus_flask_exporter-0.15.4-py3-none-any.whl size=16451 sha256=e5ed543196680fbd7108c543d469249cd160e6255c433b3f9f4f9a9b21d126fc
Stored in directory: /root/.cache/pip/wheels/69/e3/ab/f10afded2fa6225f1672b34a7438cadf596e359a21f454d22c
Building wheel for databricks-cli (setup.py) ... done
Created wheel for databricks-cli: filename=databricks_cli-0.11.0-py3-none-any.whl size=90300 sha256=b5a56f384d753c2d54bc7e8f022672cbe13848119d0b92dcc0f671738a782dca
Stored in directory: /root/.cache/pip/wheels/81/3f/18/5678c9d403583e583a251463196998b17852b98de34aa9ab51
Building wheel for sqlalchemy (setup.py) ... done
Created wheel for sqlalchemy: filename=SQLAlchemy-1.3.13-cp37-cp37m-linux_x86_64.whl size=1221855 sha256=e009c1d130fcb7a3caa35c14649001533f0ec7da0b857267318d6dd4375985aa
Stored in directory: /root/.cache/pip/wheels/b9/ba/77/163f10f14bd489351530603e750c195b0ceceed2f3be2b32f1
Building wheel for querystring-parser (setup.py) ... done
Created wheel for querystring-parser: filename=querystring_parser-1.2.4-py3-none-any.whl size=7076 sha256=5ffc4d11d9964eefab8c52e2f98be00e9b5c1efa9596a3f39c93d30c98919553
Stored in directory: /root/.cache/pip/wheels/69/38/7a/072b5863ca334d012821a287fd1d066cea33abdcda3ef2f878
Successfully built pyod combo suod prometheus-flask-exporter databricks-cli sqlalchemy querystring-parser
Installing collected packages: combo, suod, pyod, prometheus-flask-exporter, databricks-cli, azure-core, isodate, msrest, azure-storage-blob, sqlalchemy, querystring-parser, gorilla, gunicorn, mlflow, zope.interface, DateTime, datefinder, pycaret
Attempting uninstall: sqlalchemy
Found existing installation: SQLAlchemy 1.3.16
Uninstalling SQLAlchemy-1.3.16:
Successfully uninstalled SQLAlchemy-1.3.16
Successfully installed DateTime-4.3 azure-core-1.7.0 azure-storage-blob-12.3.2 combo-0.1.1 databricks-cli-0.11.0 datefinder-0.7.1 gorilla-0.3.0 gunicorn-20.0.4 isodate-0.6.0 mlflow-1.10.0 msrest-0.6.18 prometheus-flask-exporter-0.15.4 pycaret-2.0 pyod-0.8.1 querystring-parser-1.2.4 sqlalchemy-1.3.13 suod-0.0.4 zope.interface-5.1.0
WARNING: You are using pip version 20.1.1; however, version 20.2 is available.
You should consider upgrading via the '/opt/conda/bin/python3.7 -m pip install --upgrade pip' command.
Note: you may need to restart the kernel to use updated packages.
Since Problem is classification, you can read about other options here: Modules
from pycaret.classification import *
The use case is simple you have to setup a preprocessing pipeline with 'setup' module, select the target and name your experiment.
you can specify a session_id, if you didn't by default a random seed is generated and returned in the Information grid. The unique number is then distributed as a seed in all functions used during the experiment. This can be used for later reproducibility of the entire experiment.
session_1 = setup(df1, target = 'quality', session_id=123, log_experiment=False, experiment_name='wine_q1')
Setup Succesfully Completed!
Description | Value | |
---|---|---|
0 | session_id | 123 |
1 | Target Type | Multiclass |
2 | Label Encoded | None |
3 | Original Data | (1599, 12) |
4 | Missing Values | False |
5 | Numeric Features | 11 |
6 | Categorical Features | 0 |
7 | Ordinal Features | False |
8 | High Cardinality Features | False |
9 | High Cardinality Method | None |
10 | Sampled Data | (1599, 12) |
11 | Transformed Train Set | (1119, 11) |
12 | Transformed Test Set | (480, 11) |
13 | Numeric Imputer | mean |
14 | Categorical Imputer | constant |
15 | Normalize | False |
16 | Normalize Method | None |
17 | Transformation | False |
18 | Transformation Method | None |
19 | PCA | False |
20 | PCA Method | None |
21 | PCA Components | None |
22 | Ignore Low Variance | False |
23 | Combine Rare Levels | False |
24 | Rare Level Threshold | None |
25 | Numeric Binning | False |
26 | Remove Outliers | False |
27 | Outliers Threshold | None |
28 | Remove Multicollinearity | False |
29 | Multicollinearity Threshold | None |
30 | Clustering | False |
31 | Clustering Iteration | None |
32 | Polynomial Features | False |
33 | Polynomial Degree | None |
34 | Trignometry Features | False |
35 | Polynomial Threshold | None |
36 | Group Features | False |
37 | Feature Selection | False |
38 | Features Selection Threshold | None |
39 | Feature Interaction | False |
40 | Feature Ratio | False |
41 | Interaction Threshold | None |
42 | Fix Imbalance | False |
43 | Fix Imbalance Method | SMOTE |
you can complete details about all functions here 1
compare_model(): This function train all the models available in the model library and scores them.
I blacklisted 'catboost' as it was taking much time in k-folds, you can test if it helps in accuracy and other metrics
best_model = compare_models(blacklist=['catboost'])
Model | Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | TT (Sec) | |
---|---|---|---|---|---|---|---|---|---|
0 | Extra Trees Classifier | 0.6658 | 0.0000 | 0.3701 | 0.6409 | 0.6453 | 0.4541 | 0.4584 | 1.3902 |
1 | Light Gradient Boosting Machine | 0.6524 | 0.0000 | 0.3760 | 0.6256 | 0.6344 | 0.4388 | 0.4432 | 0.5277 |
2 | Extreme Gradient Boosting | 0.6435 | 0.0000 | 0.3752 | 0.6178 | 0.6274 | 0.4278 | 0.4306 | 0.6911 |
3 | Random Forest Classifier | 0.6426 | 0.0000 | 0.3728 | 0.6176 | 0.6267 | 0.4265 | 0.4296 | 0.3988 |
4 | Gradient Boosting Classifier | 0.6283 | 0.0000 | 0.3589 | 0.6082 | 0.6130 | 0.4013 | 0.4043 | 1.6138 |
5 | Ada Boost Classifier | 0.6024 | 0.0000 | 0.3498 | 0.5848 | 0.5854 | 0.3544 | 0.3586 | 0.9083 |
6 | Linear Discriminant Analysis | 0.5969 | 0.0000 | 0.2892 | 0.5741 | 0.5714 | 0.3352 | 0.3410 | 0.0364 |
7 | Ridge Classifier | 0.5880 | 0.0000 | 0.2509 | 0.4973 | 0.5318 | 0.2989 | 0.3103 | 0.0383 |
8 | Logistic Regression | 0.5853 | 0.0000 | 0.2602 | 0.5387 | 0.5411 | 0.3005 | 0.3098 | 0.2686 |
9 | Naive Bayes | 0.5657 | 0.0000 | 0.3083 | 0.5614 | 0.5588 | 0.3155 | 0.3183 | 0.0245 |
10 | Quadratic Discriminant Analysis | 0.5594 | 0.0000 | 0.3334 | 0.5543 | 0.5482 | 0.2936 | 0.2994 | 0.0293 |
11 | Decision Tree Classifier | 0.5121 | 0.0000 | 0.3824 | 0.6239 | 0.5551 | 0.3108 | 0.3236 | 0.0574 |
12 | K Neighbors Classifier | 0.4835 | 0.0000 | 0.2604 | 0.4667 | 0.4728 | 0.1828 | 0.1840 | 0.0279 |
13 | SVM - Linear Kernel | 0.4432 | 0.0000 | 0.2087 | 0.3790 | 0.3354 | 0.1040 | 0.1401 | 0.0492 |
models() provide list of models in library and their id that can be used in functions
models()
Name | Reference | Turbo | |
---|---|---|---|
ID | |||
lr | Logistic Regression | sklearn.linear_model.LogisticRegression | True |
knn | K Neighbors Classifier | sklearn.neighbors.KNeighborsClassifier | True |
nb | Naive Bayes | sklearn.naive_bayes.GaussianNB | True |
dt | Decision Tree Classifier | sklearn.tree.DecisionTreeClassifier | True |
svm | SVM - Linear Kernel | sklearn.linear_model.SGDClassifier | True |
rbfsvm | SVM - Radial Kernel | sklearn.svm.SVC | False |
gpc | Gaussian Process Classifier | sklearn.gaussian_process.GPC | False |
mlp | MLP Classifier | sklearn.neural_network.MLPClassifier | False |
ridge | Ridge Classifier | sklearn.linear_model.RidgeClassifier | True |
rf | Random Forest Classifier | sklearn.ensemble.RandomForestClassifier | True |
qda | Quadratic Discriminant Analysis | sklearn.discriminant_analysis.QDA | True |
ada | Ada Boost Classifier | sklearn.ensemble.AdaBoostClassifier | True |
gbc | Gradient Boosting Classifier | sklearn.ensemble.GradientBoostingClassifier | True |
lda | Linear Discriminant Analysis | sklearn.discriminant_analysis.LDA | True |
et | Extra Trees Classifier | sklearn.ensemble.ExtraTreesClassifier | True |
xgboost | Extreme Gradient Boosting | xgboost.readthedocs.io | True |
lightgbm | Light Gradient Boosting Machine | github.com/microsoft/LightGBM | True |
catboost | CatBoost Classifier | catboost.ai | True |
#creating random forest model
rf = create_model('rf')
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.7232 | 0.0000 | 0.4492 | 0.7043 | 0.7069 | 0.5540 | 0.5629 |
1 | 0.6518 | 0.0000 | 0.3929 | 0.6264 | 0.6385 | 0.4395 | 0.4404 |
2 | 0.5893 | 0.0000 | 0.3009 | 0.5809 | 0.5831 | 0.3561 | 0.3574 |
3 | 0.6607 | 0.0000 | 0.4807 | 0.6330 | 0.6460 | 0.4586 | 0.4598 |
4 | 0.6696 | 0.0000 | 0.3212 | 0.6307 | 0.6468 | 0.4625 | 0.4658 |
5 | 0.6250 | 0.0000 | 0.3118 | 0.6057 | 0.6111 | 0.4059 | 0.4102 |
6 | 0.5625 | 0.0000 | 0.2925 | 0.5310 | 0.5442 | 0.3007 | 0.3030 |
7 | 0.6875 | 0.0000 | 0.3355 | 0.6467 | 0.6644 | 0.4926 | 0.4959 |
8 | 0.5982 | 0.0000 | 0.4472 | 0.5853 | 0.5826 | 0.3455 | 0.3490 |
9 | 0.6577 | 0.0000 | 0.3965 | 0.6319 | 0.6437 | 0.4500 | 0.4517 |
Mean | 0.6426 | 0.0000 | 0.3728 | 0.6176 | 0.6267 | 0.4265 | 0.4296 |
SD | 0.0463 | 0.0000 | 0.0659 | 0.0437 | 0.0447 | 0.0717 | 0.0729 |
#creating Extra Trees Classifier
et = create_model('et')
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.6696 | 0.0000 | 0.4026 | 0.6524 | 0.6572 | 0.4625 | 0.4652 |
1 | 0.6339 | 0.0000 | 0.3446 | 0.6266 | 0.6126 | 0.3912 | 0.3970 |
2 | 0.6607 | 0.0000 | 0.3298 | 0.6364 | 0.6465 | 0.4539 | 0.4567 |
3 | 0.6696 | 0.0000 | 0.4674 | 0.6287 | 0.6435 | 0.4610 | 0.4654 |
4 | 0.6607 | 0.0000 | 0.3010 | 0.6230 | 0.6329 | 0.4415 | 0.4480 |
5 | 0.7143 | 0.0000 | 0.3479 | 0.6794 | 0.6960 | 0.5434 | 0.5449 |
6 | 0.6518 | 0.0000 | 0.3291 | 0.6166 | 0.6302 | 0.4338 | 0.4381 |
7 | 0.7054 | 0.0000 | 0.3263 | 0.6663 | 0.6789 | 0.5182 | 0.5234 |
8 | 0.5982 | 0.0000 | 0.4387 | 0.6130 | 0.5775 | 0.3343 | 0.3413 |
9 | 0.6937 | 0.0000 | 0.4139 | 0.6670 | 0.6777 | 0.5015 | 0.5044 |
Mean | 0.6658 | 0.0000 | 0.3701 | 0.6409 | 0.6453 | 0.4541 | 0.4584 |
SD | 0.0325 | 0.0000 | 0.0532 | 0.0223 | 0.0331 | 0.0577 | 0.0565 |
#light GBM Model
lgbm = create_model('lightgbm')
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.6607 | 0.0000 | 0.3987 | 0.6495 | 0.6495 | 0.4539 | 0.4600 |
1 | 0.6518 | 0.0000 | 0.3926 | 0.6205 | 0.6342 | 0.4335 | 0.4358 |
2 | 0.6161 | 0.0000 | 0.3028 | 0.5970 | 0.6013 | 0.3767 | 0.3826 |
3 | 0.6786 | 0.0000 | 0.4711 | 0.6403 | 0.6510 | 0.4733 | 0.4789 |
4 | 0.6429 | 0.0000 | 0.3269 | 0.6126 | 0.6253 | 0.4216 | 0.4241 |
5 | 0.6250 | 0.0000 | 0.3194 | 0.6079 | 0.6151 | 0.4132 | 0.4144 |
6 | 0.6518 | 0.0000 | 0.3451 | 0.6168 | 0.6269 | 0.4391 | 0.4479 |
7 | 0.6786 | 0.0000 | 0.3143 | 0.6328 | 0.6508 | 0.4797 | 0.4851 |
8 | 0.6339 | 0.0000 | 0.4695 | 0.6182 | 0.6191 | 0.4057 | 0.4088 |
9 | 0.6847 | 0.0000 | 0.4199 | 0.6603 | 0.6704 | 0.4917 | 0.4947 |
Mean | 0.6524 | 0.0000 | 0.3760 | 0.6256 | 0.6344 | 0.4388 | 0.4432 |
SD | 0.0223 | 0.0000 | 0.0602 | 0.0187 | 0.0198 | 0.0344 | 0.0348 |
#creating XGB model
xgboost = create_model('xgboost')
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.6429 | 0.0000 | 0.3991 | 0.6155 | 0.6287 | 0.4250 | 0.4260 |
1 | 0.6518 | 0.0000 | 0.3923 | 0.6241 | 0.6357 | 0.4387 | 0.4413 |
2 | 0.6161 | 0.0000 | 0.3122 | 0.6053 | 0.6068 | 0.3888 | 0.3925 |
3 | 0.6786 | 0.0000 | 0.4791 | 0.6402 | 0.6541 | 0.4774 | 0.4821 |
4 | 0.6161 | 0.0000 | 0.3158 | 0.5883 | 0.6016 | 0.3863 | 0.3873 |
5 | 0.6161 | 0.0000 | 0.3158 | 0.5950 | 0.6045 | 0.3987 | 0.3994 |
6 | 0.6696 | 0.0000 | 0.3526 | 0.6317 | 0.6464 | 0.4687 | 0.4742 |
7 | 0.6875 | 0.0000 | 0.3268 | 0.6534 | 0.6684 | 0.4997 | 0.5020 |
8 | 0.5536 | 0.0000 | 0.4292 | 0.5469 | 0.5408 | 0.2736 | 0.2766 |
9 | 0.7027 | 0.0000 | 0.4290 | 0.6779 | 0.6875 | 0.5210 | 0.5249 |
Mean | 0.6435 | 0.0000 | 0.3752 | 0.6178 | 0.6274 | 0.4278 | 0.4306 |
SD | 0.0422 | 0.0000 | 0.0560 | 0.0349 | 0.0394 | 0.0678 | 0.0683 |
You can witness how easy is to create model and CV it
Similarly, you can tune your model with best hyper params with just single line of code, isn't it amazing
#Hyper params tuning via tune_model
tuned_rf = tune_model(rf)
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.6964 | 0.0000 | 0.4258 | 0.6772 | 0.6818 | 0.5061 | 0.5117 |
1 | 0.6875 | 0.0000 | 0.3904 | 0.6612 | 0.6670 | 0.4837 | 0.4882 |
2 | 0.6339 | 0.0000 | 0.3100 | 0.6103 | 0.6176 | 0.4055 | 0.4109 |
3 | 0.7054 | 0.0000 | 0.4821 | 0.6644 | 0.6765 | 0.5173 | 0.5233 |
4 | 0.6429 | 0.0000 | 0.3187 | 0.6198 | 0.6275 | 0.4226 | 0.4257 |
5 | 0.6786 | 0.0000 | 0.3329 | 0.6402 | 0.6582 | 0.4852 | 0.4872 |
6 | 0.6161 | 0.0000 | 0.3227 | 0.5829 | 0.5955 | 0.3778 | 0.3821 |
7 | 0.7054 | 0.0000 | 0.3259 | 0.6555 | 0.6757 | 0.5190 | 0.5246 |
8 | 0.5893 | 0.0000 | 0.4346 | 0.5618 | 0.5676 | 0.3264 | 0.3302 |
9 | 0.7117 | 0.0000 | 0.4425 | 0.6824 | 0.6961 | 0.5345 | 0.5363 |
Mean | 0.6667 | 0.0000 | 0.3786 | 0.6356 | 0.6464 | 0.4578 | 0.4620 |
SD | 0.0408 | 0.0000 | 0.0605 | 0.0387 | 0.0401 | 0.0668 | 0.0668 |
And you can see the params of your best model as well
tuned_rf
OneVsRestClassifier(estimator=RandomForestClassifier(bootstrap=False, ccp_alpha=0.0, class_weight=None, criterion='entropy', max_depth=20, max_features='log2', max_leaf_nodes=None, max_samples=None, min_impurity_decrease=0.0, min_impurity_split=None, min_samples_leaf=4, min_samples_split=7, min_weight_fraction_leaf=0.0, n_estimators=60, n_jobs=-1, oob_score=False, random_state=123, verbose=0, warm_start=False), n_jobs=None)
tuned_et = tune_model(et)
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.7054 | 0.0000 | 0.4297 | 0.6798 | 0.6898 | 0.5199 | 0.5228 |
1 | 0.6607 | 0.0000 | 0.3768 | 0.6339 | 0.6389 | 0.4384 | 0.4438 |
2 | 0.6696 | 0.0000 | 0.3239 | 0.6391 | 0.6500 | 0.4579 | 0.4622 |
3 | 0.6964 | 0.0000 | 0.4782 | 0.6620 | 0.6663 | 0.5003 | 0.5080 |
4 | 0.6429 | 0.0000 | 0.3020 | 0.6162 | 0.6195 | 0.4120 | 0.4176 |
5 | 0.7054 | 0.0000 | 0.3440 | 0.6658 | 0.6849 | 0.5283 | 0.5300 |
6 | 0.6339 | 0.0000 | 0.3300 | 0.6009 | 0.6126 | 0.4064 | 0.4119 |
7 | 0.6964 | 0.0000 | 0.3225 | 0.6521 | 0.6664 | 0.5005 | 0.5071 |
8 | 0.5357 | 0.0000 | 0.4041 | 0.5580 | 0.5117 | 0.2248 | 0.2302 |
9 | 0.7027 | 0.0000 | 0.4087 | 0.6977 | 0.6863 | 0.5084 | 0.5160 |
Mean | 0.6649 | 0.0000 | 0.3720 | 0.6405 | 0.6426 | 0.4497 | 0.4550 |
SD | 0.0499 | 0.0000 | 0.0541 | 0.0388 | 0.0507 | 0.0859 | 0.0857 |
plot_model(rf)
plot_model(tuned_rf)
plot_model(rf, plot = 'boundary')
plot_model(tuned_rf, plot = 'boundary')
from imblearn.over_sampling import *
adasyn1 = ADASYN(sampling_strategy='minority')
Session_2 = setup(df1, target = 'quality', session_id=177, log_experiment=False,
experiment_name='wine_q2', normalize=True, normalize_method='zscore',
transformation=True, transformation_method = 'quantile', fix_imbalance=True,
fix_imbalance_method= adasyn1)
Setup Succesfully Completed!
Description | Value | |
---|---|---|
0 | session_id | 177 |
1 | Target Type | Multiclass |
2 | Label Encoded | None |
3 | Original Data | (1599, 12) |
4 | Missing Values | False |
5 | Numeric Features | 11 |
6 | Categorical Features | 0 |
7 | Ordinal Features | False |
8 | High Cardinality Features | False |
9 | High Cardinality Method | None |
10 | Sampled Data | (1599, 12) |
11 | Transformed Train Set | (1119, 11) |
12 | Transformed Test Set | (480, 11) |
13 | Numeric Imputer | mean |
14 | Categorical Imputer | constant |
15 | Normalize | True |
16 | Normalize Method | zscore |
17 | Transformation | True |
18 | Transformation Method | quantile |
19 | PCA | False |
20 | PCA Method | None |
21 | PCA Components | None |
22 | Ignore Low Variance | False |
23 | Combine Rare Levels | False |
24 | Rare Level Threshold | None |
25 | Numeric Binning | False |
26 | Remove Outliers | False |
27 | Outliers Threshold | None |
28 | Remove Multicollinearity | False |
29 | Multicollinearity Threshold | None |
30 | Clustering | False |
31 | Clustering Iteration | None |
32 | Polynomial Features | False |
33 | Polynomial Degree | None |
34 | Trignometry Features | False |
35 | Polynomial Threshold | None |
36 | Group Features | False |
37 | Feature Selection | False |
38 | Features Selection Threshold | None |
39 | Feature Interaction | False |
40 | Feature Ratio | False |
41 | Interaction Threshold | None |
42 | Fix Imbalance | True |
43 | Fix Imbalance Method | ADASYN |
You can several of the func are now shahed green because i will be envolving them in pipeline
best_model1 = compare_models(blacklist=['catboost'])
Model | Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | TT (Sec) | |
---|---|---|---|---|---|---|---|---|---|
0 | Extreme Gradient Boosting | 0.6515 | 0.0000 | 0.3496 | 0.6383 | 0.6396 | 0.4443 | 0.4481 | 1.0652 |
1 | Extra Trees Classifier | 0.6497 | 0.0000 | 0.3097 | 0.6259 | 0.6309 | 0.4301 | 0.4349 | 1.4918 |
2 | Light Gradient Boosting Machine | 0.6461 | 0.0000 | 0.3306 | 0.6263 | 0.6305 | 0.4296 | 0.4336 | 1.2280 |
3 | Gradient Boosting Classifier | 0.6354 | 0.0000 | 0.3097 | 0.6278 | 0.6250 | 0.4168 | 0.4202 | 2.6186 |
4 | Random Forest Classifier | 0.6220 | 0.0000 | 0.3229 | 0.6041 | 0.6080 | 0.3951 | 0.3981 | 0.2860 |
5 | Ada Boost Classifier | 0.5818 | 0.0000 | 0.3097 | 0.5792 | 0.5724 | 0.3321 | 0.3356 | 1.1472 |
6 | Quadratic Discriminant Analysis | 0.5800 | 0.0000 | 0.2989 | 0.5601 | 0.5669 | 0.3260 | 0.3277 | 0.0245 |
7 | Logistic Regression | 0.5505 | 0.0000 | 0.2851 | 0.5619 | 0.5365 | 0.2852 | 0.2917 | 0.0973 |
8 | K Neighbors Classifier | 0.5478 | 0.0000 | 0.2949 | 0.5546 | 0.5470 | 0.3001 | 0.3029 | 0.0293 |
9 | Linear Discriminant Analysis | 0.5327 | 0.0000 | 0.2970 | 0.5685 | 0.5424 | 0.2861 | 0.2910 | 0.0377 |
10 | Naive Bayes | 0.5220 | 0.0000 | 0.3211 | 0.5640 | 0.5374 | 0.2839 | 0.2882 | 0.0245 |
11 | Ridge Classifier | 0.5005 | 0.0000 | 0.2507 | 0.4929 | 0.4921 | 0.2346 | 0.2441 | 0.0336 |
12 | Decision Tree Classifier | 0.4907 | 0.0000 | 0.2879 | 0.6113 | 0.5380 | 0.2845 | 0.2959 | 0.0830 |
13 | SVM - Linear Kernel | 0.4862 | 0.0000 | 0.2934 | 0.5113 | 0.4851 | 0.2141 | 0.2186 | 0.0592 |
xgboost_1 = create_model('xgboost')
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.5804 | 0.0000 | 0.2934 | 0.5779 | 0.5770 | 0.3509 | 0.3525 |
1 | 0.7143 | 0.0000 | 0.5190 | 0.6892 | 0.6997 | 0.5423 | 0.5442 |
2 | 0.6161 | 0.0000 | 0.3024 | 0.5925 | 0.6033 | 0.3821 | 0.3833 |
3 | 0.6429 | 0.0000 | 0.3357 | 0.6235 | 0.6315 | 0.4335 | 0.4356 |
4 | 0.5625 | 0.0000 | 0.2513 | 0.5258 | 0.5382 | 0.2878 | 0.2917 |
5 | 0.6875 | 0.0000 | 0.3355 | 0.6545 | 0.6668 | 0.4932 | 0.4970 |
6 | 0.6161 | 0.0000 | 0.2915 | 0.6065 | 0.6075 | 0.3928 | 0.3967 |
7 | 0.6875 | 0.0000 | 0.4202 | 0.6574 | 0.6708 | 0.4918 | 0.4940 |
8 | 0.6786 | 0.0000 | 0.3381 | 0.6528 | 0.6632 | 0.4799 | 0.4830 |
9 | 0.6847 | 0.0000 | 0.3496 | 0.6662 | 0.6750 | 0.5003 | 0.5008 |
Mean | 0.6470 | 0.0000 | 0.3437 | 0.6246 | 0.6333 | 0.4355 | 0.4379 |
SD | 0.0487 | 0.0000 | 0.0723 | 0.0469 | 0.0483 | 0.0760 | 0.0757 |
et_1 = create_model('et')
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.6250 | 0.0000 | 0.3115 | 0.5935 | 0.6083 | 0.4003 | 0.4019 |
1 | 0.6786 | 0.0000 | 0.3170 | 0.6496 | 0.6573 | 0.4789 | 0.4857 |
2 | 0.6518 | 0.0000 | 0.2983 | 0.6211 | 0.6324 | 0.4321 | 0.4349 |
3 | 0.6161 | 0.0000 | 0.2996 | 0.6066 | 0.6033 | 0.3786 | 0.3829 |
4 | 0.6071 | 0.0000 | 0.2609 | 0.5535 | 0.5703 | 0.3508 | 0.3587 |
5 | 0.6429 | 0.0000 | 0.3179 | 0.6370 | 0.6317 | 0.4228 | 0.4267 |
6 | 0.6696 | 0.0000 | 0.3224 | 0.6561 | 0.6534 | 0.4689 | 0.4778 |
7 | 0.6518 | 0.0000 | 0.3188 | 0.6244 | 0.6351 | 0.4364 | 0.4398 |
8 | 0.6786 | 0.0000 | 0.3219 | 0.6724 | 0.6650 | 0.4733 | 0.4777 |
9 | 0.6757 | 0.0000 | 0.3377 | 0.6467 | 0.6588 | 0.4715 | 0.4739 |
Mean | 0.6497 | 0.0000 | 0.3106 | 0.6261 | 0.6315 | 0.4313 | 0.4360 |
SD | 0.0252 | 0.0000 | 0.0198 | 0.0330 | 0.0285 | 0.0417 | 0.0418 |
lgbm_1 = create_model('lightgbm')
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.6339 | 0.0000 | 0.3237 | 0.6221 | 0.6244 | 0.4242 | 0.4280 |
1 | 0.7054 | 0.0000 | 0.3443 | 0.6701 | 0.6832 | 0.5211 | 0.5259 |
2 | 0.6696 | 0.0000 | 0.3146 | 0.6345 | 0.6501 | 0.4627 | 0.4647 |
3 | 0.6250 | 0.0000 | 0.3034 | 0.6057 | 0.6113 | 0.3980 | 0.4014 |
4 | 0.5982 | 0.0000 | 0.2739 | 0.5554 | 0.5693 | 0.3382 | 0.3437 |
5 | 0.6518 | 0.0000 | 0.3048 | 0.6398 | 0.6313 | 0.4293 | 0.4352 |
6 | 0.6250 | 0.0000 | 0.2872 | 0.6063 | 0.6092 | 0.3991 | 0.4053 |
7 | 0.6696 | 0.0000 | 0.4215 | 0.6455 | 0.6558 | 0.4697 | 0.4719 |
8 | 0.6607 | 0.0000 | 0.4063 | 0.6437 | 0.6458 | 0.4551 | 0.4618 |
9 | 0.6847 | 0.0000 | 0.4016 | 0.6828 | 0.6831 | 0.5022 | 0.5024 |
Mean | 0.6524 | 0.0000 | 0.3381 | 0.6306 | 0.6363 | 0.4400 | 0.4440 |
SD | 0.0305 | 0.0000 | 0.0505 | 0.0342 | 0.0333 | 0.0512 | 0.0504 |
gbc_1 = create_model('gbc')
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.6250 | 0.0000 | 0.3197 | 0.6219 | 0.6231 | 0.4170 | 0.4178 |
1 | 0.6696 | 0.0000 | 0.3133 | 0.6676 | 0.6609 | 0.4740 | 0.4789 |
2 | 0.5893 | 0.0000 | 0.2735 | 0.5970 | 0.5904 | 0.3581 | 0.3607 |
3 | 0.5804 | 0.0000 | 0.2851 | 0.5677 | 0.5688 | 0.3234 | 0.3264 |
4 | 0.5982 | 0.0000 | 0.2658 | 0.5605 | 0.5710 | 0.3431 | 0.3487 |
5 | 0.6250 | 0.0000 | 0.3019 | 0.6182 | 0.6158 | 0.4023 | 0.4059 |
6 | 0.5804 | 0.0000 | 0.2605 | 0.5597 | 0.5625 | 0.3222 | 0.3266 |
7 | 0.6161 | 0.0000 | 0.3562 | 0.6042 | 0.6076 | 0.3857 | 0.3875 |
8 | 0.6429 | 0.0000 | 0.2984 | 0.6314 | 0.6268 | 0.4166 | 0.4216 |
9 | 0.6847 | 0.0000 | 0.3414 | 0.6722 | 0.6781 | 0.4995 | 0.5000 |
Mean | 0.6211 | 0.0000 | 0.3016 | 0.6100 | 0.6105 | 0.3942 | 0.3974 |
SD | 0.0343 | 0.0000 | 0.0301 | 0.0385 | 0.0368 | 0.0572 | 0.0567 |
tuned_xgboost1 = tune_model(xgboost_1)
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.5804 | 0.0000 | 0.3015 | 0.5606 | 0.5694 | 0.3431 | 0.3440 |
1 | 0.6696 | 0.0000 | 0.4925 | 0.6397 | 0.6521 | 0.4708 | 0.4727 |
2 | 0.5804 | 0.0000 | 0.2698 | 0.5635 | 0.5712 | 0.3316 | 0.3325 |
3 | 0.6161 | 0.0000 | 0.3078 | 0.6040 | 0.6069 | 0.3864 | 0.3885 |
4 | 0.5804 | 0.0000 | 0.2670 | 0.5545 | 0.5583 | 0.3142 | 0.3188 |
5 | 0.6607 | 0.0000 | 0.3627 | 0.6600 | 0.6536 | 0.4566 | 0.4593 |
6 | 0.5893 | 0.0000 | 0.2724 | 0.5841 | 0.5828 | 0.3521 | 0.3551 |
7 | 0.6786 | 0.0000 | 0.4150 | 0.6569 | 0.6605 | 0.4808 | 0.4890 |
8 | 0.6161 | 0.0000 | 0.3126 | 0.6054 | 0.6058 | 0.3901 | 0.3946 |
9 | 0.6486 | 0.0000 | 0.3187 | 0.6427 | 0.6453 | 0.4455 | 0.4459 |
Mean | 0.6220 | 0.0000 | 0.3320 | 0.6072 | 0.6106 | 0.3971 | 0.4000 |
SD | 0.0374 | 0.0000 | 0.0688 | 0.0387 | 0.0375 | 0.0588 | 0.0594 |
tuned_lgbm1 = tune_model(lgbm_1)
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.5893 | 0.0000 | 0.3052 | 0.5975 | 0.5910 | 0.3689 | 0.3704 |
1 | 0.6429 | 0.0000 | 0.4651 | 0.6275 | 0.6302 | 0.4332 | 0.4351 |
2 | 0.6429 | 0.0000 | 0.3228 | 0.6435 | 0.6420 | 0.4446 | 0.4456 |
3 | 0.6339 | 0.0000 | 0.3319 | 0.6207 | 0.6243 | 0.4146 | 0.4173 |
4 | 0.5804 | 0.0000 | 0.2748 | 0.5653 | 0.5643 | 0.3286 | 0.3353 |
5 | 0.6607 | 0.0000 | 0.4006 | 0.6605 | 0.6553 | 0.4636 | 0.4674 |
6 | 0.5446 | 0.0000 | 0.2547 | 0.5453 | 0.5398 | 0.2855 | 0.2891 |
7 | 0.7232 | 0.0000 | 0.4896 | 0.7050 | 0.7124 | 0.5549 | 0.5564 |
8 | 0.6518 | 0.0000 | 0.3361 | 0.6695 | 0.6580 | 0.4533 | 0.4550 |
9 | 0.6847 | 0.0000 | 0.4010 | 0.6844 | 0.6768 | 0.5019 | 0.5050 |
Mean | 0.6354 | 0.0000 | 0.3582 | 0.6319 | 0.6294 | 0.4249 | 0.4277 |
SD | 0.0496 | 0.0000 | 0.0743 | 0.0487 | 0.0495 | 0.0759 | 0.0751 |
tuned_et1 = tune_model(et_1)
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.6518 | 0.0000 | 0.3306 | 0.6211 | 0.6353 | 0.4455 | 0.4473 |
1 | 0.6786 | 0.0000 | 0.3086 | 0.6492 | 0.6568 | 0.4794 | 0.4854 |
2 | 0.6339 | 0.0000 | 0.2911 | 0.6093 | 0.6193 | 0.4091 | 0.4108 |
3 | 0.5893 | 0.0000 | 0.2805 | 0.5821 | 0.5754 | 0.3326 | 0.3374 |
4 | 0.6071 | 0.0000 | 0.2690 | 0.5659 | 0.5734 | 0.3505 | 0.3592 |
5 | 0.6607 | 0.0000 | 0.3251 | 0.6470 | 0.6482 | 0.4537 | 0.4574 |
6 | 0.6339 | 0.0000 | 0.2826 | 0.6038 | 0.6084 | 0.4029 | 0.4121 |
7 | 0.6250 | 0.0000 | 0.3079 | 0.5987 | 0.6082 | 0.3928 | 0.3966 |
8 | 0.6339 | 0.0000 | 0.2949 | 0.6282 | 0.6167 | 0.3965 | 0.4017 |
9 | 0.6937 | 0.0000 | 0.3973 | 0.6901 | 0.6847 | 0.5044 | 0.5069 |
Mean | 0.6408 | 0.0000 | 0.3088 | 0.6195 | 0.6226 | 0.4167 | 0.4215 |
SD | 0.0299 | 0.0000 | 0.0349 | 0.0343 | 0.0331 | 0.0515 | 0.0505 |
tuned_gbc1 = tune_model(gbc_1)
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.6250 | 0.0000 | 0.3197 | 0.6063 | 0.6151 | 0.4117 | 0.4126 |
1 | 0.6964 | 0.0000 | 0.4870 | 0.6709 | 0.6767 | 0.5083 | 0.5135 |
2 | 0.6429 | 0.0000 | 0.4580 | 0.6240 | 0.6308 | 0.4267 | 0.4293 |
3 | 0.5982 | 0.0000 | 0.2996 | 0.5846 | 0.5905 | 0.3648 | 0.3654 |
4 | 0.6161 | 0.0000 | 0.2728 | 0.5855 | 0.5881 | 0.3727 | 0.3808 |
5 | 0.5893 | 0.0000 | 0.2870 | 0.5755 | 0.5766 | 0.3439 | 0.3482 |
6 | 0.6339 | 0.0000 | 0.2910 | 0.6312 | 0.6168 | 0.4073 | 0.4169 |
7 | 0.6875 | 0.0000 | 0.4098 | 0.6618 | 0.6715 | 0.4922 | 0.4952 |
8 | 0.6607 | 0.0000 | 0.3304 | 0.6628 | 0.6532 | 0.4530 | 0.4587 |
9 | 0.6667 | 0.0000 | 0.3860 | 0.6605 | 0.6586 | 0.4647 | 0.4655 |
Mean | 0.6417 | 0.0000 | 0.3541 | 0.6263 | 0.6278 | 0.4245 | 0.4286 |
SD | 0.0342 | 0.0000 | 0.0724 | 0.0349 | 0.0343 | 0.0522 | 0.0520 |
blend_soft = blend_models(estimator_list = [tuned_lgbm1, tuned_xgboost1, tuned_gbc1, tuned_et1], method = 'soft')
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.6339 | 0.0000 | 0.3152 | 0.6126 | 0.6221 | 0.4190 | 0.4206 |
1 | 0.7232 | 0.0000 | 0.5067 | 0.7014 | 0.7043 | 0.5562 | 0.5628 |
2 | 0.6786 | 0.0000 | 0.3183 | 0.6504 | 0.6625 | 0.4807 | 0.4831 |
3 | 0.6250 | 0.0000 | 0.3200 | 0.6184 | 0.6176 | 0.4013 | 0.4042 |
4 | 0.5804 | 0.0000 | 0.2586 | 0.5422 | 0.5552 | 0.3169 | 0.3211 |
5 | 0.6339 | 0.0000 | 0.3131 | 0.6032 | 0.6122 | 0.4051 | 0.4108 |
6 | 0.6250 | 0.0000 | 0.2875 | 0.6130 | 0.6059 | 0.3921 | 0.4020 |
7 | 0.7143 | 0.0000 | 0.4327 | 0.6888 | 0.6983 | 0.5392 | 0.5433 |
8 | 0.6429 | 0.0000 | 0.3153 | 0.6226 | 0.6297 | 0.4232 | 0.4261 |
9 | 0.6667 | 0.0000 | 0.3424 | 0.6361 | 0.6508 | 0.4637 | 0.4648 |
Mean | 0.6524 | 0.0000 | 0.3410 | 0.6289 | 0.6359 | 0.4397 | 0.4439 |
SD | 0.0415 | 0.0000 | 0.0697 | 0.0427 | 0.0425 | 0.0682 | 0.0681 |
Check the ROC Curves w.r.t to default setup and check improvements
plot_model(blend_soft)
stacked_lgbm = stack_models(estimator_list = [tuned_lgbm1, tuned_xgboost1, tuned_gbc1, tuned_et1],
meta_model=lgbm_1)
Accuracy | AUC | Recall | Prec. | F1 | Kappa | MCC | |
---|---|---|---|---|---|---|---|
0 | 0.6071 | 0.0000 | 0.3126 | 0.5981 | 0.6011 | 0.3875 | 0.3890 |
1 | 0.6875 | 0.0000 | 0.3371 | 0.6517 | 0.6657 | 0.4918 | 0.4956 |
2 | 0.6339 | 0.0000 | 0.3004 | 0.6036 | 0.6179 | 0.4099 | 0.4112 |
3 | 0.6339 | 0.0000 | 0.3150 | 0.6098 | 0.6191 | 0.4111 | 0.4138 |
4 | 0.5893 | 0.0000 | 0.2617 | 0.5394 | 0.5556 | 0.3225 | 0.3299 |
5 | 0.6518 | 0.0000 | 0.3048 | 0.6400 | 0.6310 | 0.4290 | 0.4354 |
6 | 0.5982 | 0.0000 | 0.2762 | 0.5740 | 0.5796 | 0.3497 | 0.3554 |
7 | 0.6607 | 0.0000 | 0.3393 | 0.6427 | 0.6499 | 0.4564 | 0.4585 |
8 | 0.6786 | 0.0000 | 0.3376 | 0.6553 | 0.6609 | 0.4812 | 0.4882 |
9 | 0.7297 | 0.0000 | 0.4116 | 0.7173 | 0.7198 | 0.5630 | 0.5650 |
Mean | 0.6471 | 0.0000 | 0.3196 | 0.6232 | 0.6301 | 0.4302 | 0.4342 |
SD | 0.0416 | 0.0000 | 0.0392 | 0.0469 | 0.0446 | 0.0674 | 0.0667 |
plot_model(lgbm_1, plot = 'confusion_matrix')
plot_model(blend_soft, plot = 'confusion_matrix')
plot_model(blend_soft, plot = 'boundary')
plot_model(lgbm_1, plot = 'boundary')
plot_model(blend_soft, plot = 'pr')
plot_model(lgbm_1, plot = 'pr')
plot_model(blend_soft, plot = 'class_report')
plot_model(lgbm_1, plot = 'class_report')
plot_model(blend_soft, plot = 'error')
plot_model(lgbm_1, plot = 'error')
plot_model(lgbm_1, plot = 'dimension')
Thanks for checking this notebook, you can contact me here for queries or at LinkedIn