<jupyter_start><jupyter_text>Link to supporting video for below notebook walkhthrough - https://www.youtube.com/watch?v=RqhTzEVkfBQ<jupyter_code>!pip install autoviml
!pip install shap
from __future__ import print_function
import sys,tempfile, urllib, os
import pandas as pd
BASE_DIR = '/tmp'
OUTPUT_FILE = os.path.join(BASE_DIR, 'churn_data.csv')
churn_df = pd.read_csv("https://raw.githubusercontent.com/srivatsan88/YouTubeLI/master/dataset/WA_Fn-UseC_-Telco-Customer-Churn.csv")
churn_df.head()
size = int(0.7*churn_df.shape[0])
train_df = churn_df[:size]
test_df = churn_df[size:]
from autoviml.Auto_ViML import Auto_ViML
target='Churn'
model, features, trainm, testm = Auto_ViML(train_df, target, test_df, sample_submission='',
                                    scoring_parameter='',
                                    hyper_param='RS',feature_reduction=True,
                                     Boosting_Flag=True,Binning_Flag=False,
                                    Add_Poly=0, Stacking_Flag=False, 
                                    Imbalanced_Flag=True, 
                                    verbose=1)<jupyter_output>##############  D A T A   S E T  A N A L Y S I S  #######################
Training Set Shape = (4930, 21)
    Training Set Memory Usage = 0.79 MB
Test Set Shape = (2113, 21)
    Test Set Memory Usage = 0.34 MB
Single_Label Target: ['Churn']

################ Binary_Classification VISUALIZATION Started #####################
Random shuffling the data set before training
    Using RandomizedSearchCV for Hyper Parameter Tuning. This is 3X faster than GridSearchCV...
       Class  -> Counts -> Percent
          No:    3641  ->   73.9%
         Yes:    1289  ->   26.1%
String or Multi Class target: Churn transformed as follows: {'No': 0, 'Yes': 1}
############## C L A S S I F Y I N G  V A R I A B L E S  ####################
Classifying variables in data set...
    Number of Numeric Columns =  1
    Number of Integer-Categorical Columns =  1
    Number of String-Categorical Columns =  10
    Number of Factor-Categorical Columns =  0
    Number of String-Boolean Columns =  5
    Number of Nume[...]<jupyter_text>hyper_param: Tuning options are GridSearch ('GS') and RandomizedSearch ('RS'). Default is 'GS'.feature_reduction: Default = 'True' but it can be set to False if you don't want automatic    Boosting Flag: you have 4 possible choices (default is False):                                 None = This will build a Linear Model                                                    False = This will build a Random Forest or Extra Trees model (also known as Bagging)          True = This will build an XGBoost model                                                       CatBoost = THis will build a CatBoost model (provided you have CatBoost installed)<jupyter_code>features
from sklearn.metrics import classification_report, confusion_matrix
testm
 print(confusion_matrix(test_df[target].values,testm['Churn_XGBoost_predictions'].values))
 print(confusion_matrix(test_df[target].values,testm['Churn_Logistic Regression_predictions'].values))
 print(confusion_matrix(test_df[target].values,testm['Churn_Ensembled_predictions'].values))
print(classification_report(test_df[target].values,testm['Churn_XGBoost_predictions'].values))
print(classification_report(test_df[target].values,testm['Churn_Ensembled_predictions'].values))<jupyter_output>precision    recall  f1-score   support

          No       0.83      0.90      0.86      1533
         Yes       0.66      0.52      0.58       580

    accuracy                           0.79      2113
   macro avg       0.74      0.71      0.72      2113
weighted avg       0.78      0.79      0.79      2113
{'fraction_non_alphanumeric': 0.10840767775074345, 'fraction_numerical': 0.029197080291970802, 'mean_word_length': 2.588748787584869, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 17, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '427119', 'license': 'Apache-2.0', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1078, 'n_words': 313, 'path': 'H20 ML Notebooks/AutoViML.ipynb', 'repo_name': 'Pandula1234/Data-Analysis-Intern', 'size': '3699'}