Churn Prediction

Customer Churn Model

Function get_data():

ArguementTypeDescription

url

string

URL of a CSV file

Returns pandas.dataframe

Usage

    df = model_churn.get_data(url = 'https://raw.githubusercontent.com/../BankChurners.csv')

Function preprocess_inputs():

InputTypeDescription

dataset

*pandas.dataframe*

Model dataset in dataframe

model_name

string

Model name as a string Default = "Logistic_Regression" | "Support_Vector_Machine" "Support_Vector_Machine_Optimized" "Decision_Tree" "Neural_Network" "Random_Forest"

Returns pandas.dataframe, pandas.dataframe

Usage

    X, y = preprocess_inputs(df, "Neural_Network")

Function pretrained():

InputTypeDescription

model_name

string

Model name as a string Default = "Logistic_Regression" | "Support_Vector_Machine" "Support_Vector_Machine_Optimized" "Decision_Tree" "Neural_Network" "Random_Forest"

Returns model

Usage

    model = pretrained("Neural_Network")

Function train():

InputTypeDescription

dataset

*pandas.dataframe*

New training dataset in dataframe

model_name

string

Model name as a string Default = "Logistic_Regression" | "Support_Vector_Machine" "Support_Vector_Machine_Optimized" "Decision_Tree" "Neural_Network" "Random_Forest"

Returns model

Usage

    model = train(df, "Neural_Network")

Function predict():

InputTypeDescription

test dataset

*pandas.dataframe*

Model test dataset in dataframe

model

function()

Model function from pretrained / train

Returns array

Usage

    print(predict(X_test, model))

Last updated