<jupyter_start><jupyter_text>**Pywedge - Classification Demo**

* Interactive Charts
* Interactive Baseline Models
* Interactive Hyperparameter Tuning
* Track Hyperparameters on-the-go!

[GitHub](https://github.com/taknev83/pywedge) | [Docs](https://taknev83.github.io/pywedge-docs/) | [PyPi](https://pypi.org/project/pywedge/)<jupyter_code># Install Pywedge

!pip install pywedge --quiet
# Import Pywedge

import pywedge as pw
# Import dataset - Credit Risk Dataset

import pandas as pd
train = pd.read_csv('https://raw.githubusercontent.com/taknev83/datasets/master/credit_risk_train.csv')
test = pd.read_csv('https://raw.githubusercontent.com/taknev83/datasets/master/credit_risk_test.csv')
train.head()
train.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 800 entries, 0 to 799
Data columns (total 21 columns):
 #   Column                  Non-Null Count  Dtype 
---  ------                  --------------  ----- 
 0   checking_status         800 non-null    object
 1   duration                800 non-null    int64 
 2   credit_history          800 non-null    object
 3   purpose                 800 non-null    object
 4   credit_amount           800 non-null    int64 
 5   savings_status          800 non-null    object
 6   employment              800 non-null    object
 7   installment_commitment  800 non-null    int64 
 8   personal_status         800 non-null    object
 9   other_parties           800 non-null    object
 10  residence_since         800 non-null    int64 
 11  property_magnitude      800 non-null    object
 12  age                     800 non-null    int64 
 13  other_payment_plans     800 non-null    object
 14  housing                 800 non-null    object
 15  existi[...]<jupyter_text>Instantiate Pywedge_Charts
T
he Pywedge_Charts class takes following inputs,

Inputs:

* Dataframe
* c = any redundant column to be removed (like ID column etc., at present supports a single column removal, subsequent version will provision multiple column removal requirements)
* y = target column name as a string

Returns:

Charts widget<jupyter_code>mc = pw.Pywedge_Charts(train, c=None, y = 'class')<jupyter_output><empty_output><jupyter_text>Call make_charts method from the instantiated class<jupyter_code>charts = mc.make_charts()<jupyter_output><empty_output><jupyter_text>Instantiate baseline_model class
Args:

* train = train dataframe
* test = test dataframe
* c = any redundant column to be removed (like ID column etc., at present supports a single column removal, subsequent version will provision multiple column removal requirements)
* y = target column name as a string
* type = Classification(Default) / Regression<jupyter_code>blm = pw.baseline_model(train, test, c=None, y='class')<jupyter_output><empty_output><jupyter_text>Call Classification_Summary method for Regression type of tasks

Returns:

* Interactive pre-processing steps
* User input for test size in train test split
* Top 10 feature importance using Adaboost regressor
* Baseline models in 10 different algorithms with metrics
* Predict selected baseline models on standout test dataset<jupyter_code>blm.classification_summary()<jupyter_output><empty_output><jupyter_text>Instantiate Pywedge_HP Class for interactive hyperparameter tuning

Args:

* train = train dataframe
* test = test dataframe
* c = any redundant column to be removed (like ID column etc., at present supports a single column removal, subsequent version will provision multiple column removal requirements)
* y = target column name as a string
* tracking = True/False(Default) to enable mlflow hyperpameter tracking<jupyter_code>pph = pw.Pywedge_HP(train, test, c=None, y='class', tracking=True)<jupyter_output><empty_output><jupyter_text>Install mlflow version 1.12.1<jupyter_code>pip install mlflow==1.12.1 --quiet<jupyter_output><empty_output><jupyter_text>Call HP_Tune_Classification for classification hyperparameter tuning tasks

Returns:

* Interactive widget for inputing various hyperparameters
* Output tab with tuned model results
* Predictions on standout test data using tuned model<jupyter_code>pph.HP_Tune_Classification()<jupyter_output><empty_output><jupyter_text>Install pyngrok to create a tunnel to access MLFlow User Interface<jupyter_code>!pip install pyngrok --quiet<jupyter_output><empty_output><jupyter_text>Call get_tracking method from instantiated class to get MLFLow tracking URL<jupyter_code>pph.get_tracking_url()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07884187082405346, 'fraction_numerical': 0.023608017817371936, 'mean_word_length': 4.109215017064846, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '114054', 'license': 'MIT', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1308, 'n_words': 400, 'path': 'Examples/Pywedge_Classification.ipynb', 'repo_name': 'alihasanahmedkhan/pywedge', 'size': '4490'}