metadata
license: mit
library_name: sklearn
tags:
- sklearn
- skops
- tabular-classification
model_file: churn.pkl
widget:
structuredData:
Contract:
- Two year
- Month-to-month
- One year
Dependents:
- 'Yes'
- 'No'
- 'No'
DeviceProtection:
- 'No'
- 'No'
- 'Yes'
InternetService:
- Fiber optic
- Fiber optic
- DSL
MonthlyCharges:
- 79.05
- 84.95
- 68.8
MultipleLines:
- 'Yes'
- 'Yes'
- 'Yes'
OnlineBackup:
- 'No'
- 'No'
- 'Yes'
OnlineSecurity:
- 'Yes'
- 'No'
- 'Yes'
PaperlessBilling:
- 'No'
- 'Yes'
- 'No'
Partner:
- 'Yes'
- 'Yes'
- 'No'
PaymentMethod:
- Bank transfer (automatic)
- Electronic check
- Bank transfer (automatic)
PhoneService:
- 'Yes'
- 'Yes'
- 'Yes'
SeniorCitizen:
- 0
- 0
- 0
StreamingMovies:
- 'No'
- 'No'
- 'No'
StreamingTV:
- 'No'
- 'Yes'
- 'No'
TechSupport:
- 'No'
- 'No'
- 'Yes'
TotalCharges:
- 5730.7
- 1378.25
- 4111.35
gender:
- Female
- Female
- Male
tenure:
- 72
- 16
- 63
Model description
This is a Logistic Regression model trained on churn dataset.
Intended uses & limitations
This model is not ready to be used in production.
Training Procedure
Hyperparameters
The model is trained with below hyperparameters.
Click to expand
Hyperparameter | Value |
---|---|
memory | |
steps | [('preprocessor', ColumnTransformer(transformers=[('num', Pipeline(steps=[('imputer', SimpleImputer(strategy='median')), ('std_scaler', StandardScaler())]), ['MonthlyCharges', 'TotalCharges', 'tenure']), ('cat', OneHotEncoder(handle_unknown='ignore'), ['SeniorCitizen', 'gender', 'Partner', 'Dependents', 'PhoneService', 'MultipleLines', 'InternetService', 'OnlineSecurity', 'OnlineBackup', 'DeviceProtection', 'TechSupport', 'StreamingTV', 'StreamingMovies', 'Contract', 'PaperlessBilling', 'PaymentMethod'])])), ('classifier', LogisticRegression(class_weight='balanced', max_iter=300))] |
verbose | False |
preprocessor | ColumnTransformer(transformers=[('num', Pipeline(steps=[('imputer', SimpleImputer(strategy='median')), ('std_scaler', StandardScaler())]), ['MonthlyCharges', 'TotalCharges', 'tenure']), ('cat', OneHotEncoder(handle_unknown='ignore'), ['SeniorCitizen', 'gender', 'Partner', 'Dependents', 'PhoneService', 'MultipleLines', 'InternetService', 'OnlineSecurity', 'OnlineBackup', 'DeviceProtection', 'TechSupport', 'StreamingTV', 'StreamingMovies', 'Contract', 'PaperlessBilling', 'PaymentMethod'])]) |
classifier | LogisticRegression(class_weight='balanced', max_iter=300) |
preprocessor__n_jobs | |
preprocessor__remainder | drop |
preprocessor__sparse_threshold | 0.3 |
preprocessor__transformer_weights | |
preprocessor__transformers | [('num', Pipeline(steps=[('imputer', SimpleImputer(strategy='median')), ('std_scaler', StandardScaler())]), ['MonthlyCharges', 'TotalCharges', 'tenure']), ('cat', OneHotEncoder(handle_unknown='ignore'), ['SeniorCitizen', 'gender', 'Partner', 'Dependents', 'PhoneService', 'MultipleLines', 'InternetService', 'OnlineSecurity', 'OnlineBackup', 'DeviceProtection', 'TechSupport', 'StreamingTV', 'StreamingMovies', 'Contract', 'PaperlessBilling', 'PaymentMethod'])] |
preprocessor__verbose | False |
preprocessor__verbose_feature_names_out | True |
preprocessor__num | Pipeline(steps=[('imputer', SimpleImputer(strategy='median')), ('std_scaler', StandardScaler())]) |
preprocessor__cat | OneHotEncoder(handle_unknown='ignore') |
preprocessor__num__memory | |
preprocessor__num__steps | [('imputer', SimpleImputer(strategy='median')), ('std_scaler', StandardScaler())] |
preprocessor__num__verbose | False |
preprocessor__num__imputer | SimpleImputer(strategy='median') |
preprocessor__num__std_scaler | StandardScaler() |
preprocessor__num__imputer__add_indicator | False |
preprocessor__num__imputer__copy | True |
preprocessor__num__imputer__fill_value | |
preprocessor__num__imputer__missing_values | nan |
preprocessor__num__imputer__strategy | median |
preprocessor__num__imputer__verbose | deprecated |
preprocessor__num__std_scaler__copy | True |
preprocessor__num__std_scaler__with_mean | True |
preprocessor__num__std_scaler__with_std | True |
preprocessor__cat__categories | auto |
preprocessor__cat__drop | |
preprocessor__cat__dtype | <class 'numpy.float64'> |
preprocessor__cat__handle_unknown | ignore |
preprocessor__cat__max_categories | |
preprocessor__cat__min_frequency | |
preprocessor__cat__sparse | True |
classifier__C | 1.0 |
classifier__class_weight | balanced |
classifier__dual | False |
classifier__fit_intercept | True |
classifier__intercept_scaling | 1 |
classifier__l1_ratio | |
classifier__max_iter | 300 |
classifier__multi_class | auto |
classifier__n_jobs | |
classifier__penalty | l2 |
classifier__random_state | |
classifier__solver | lbfgs |
classifier__tol | 0.0001 |
classifier__verbose | 0 |
classifier__warm_start | False |
Model Plot
The model plot is below.
Pipeline(steps=[('preprocessor',ColumnTransformer(transformers=[('num',Pipeline(steps=[('imputer',SimpleImputer(strategy='median')),('std_scaler',StandardScaler())]),['MonthlyCharges','TotalCharges', 'tenure']),('cat',OneHotEncoder(handle_unknown='ignore'),['SeniorCitizen', 'gender','Partner', 'Dependents','PhoneService','MultipleLines','InternetService','OnlineSecurity','OnlineBackup','DeviceProtection','TechSupport', 'StreamingTV','StreamingMovies','Contract','PaperlessBilling','PaymentMethod'])])),('classifier',LogisticRegression(class_weight='balanced', max_iter=300))])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
Pipeline(steps=[('preprocessor',ColumnTransformer(transformers=[('num',Pipeline(steps=[('imputer',SimpleImputer(strategy='median')),('std_scaler',StandardScaler())]),['MonthlyCharges','TotalCharges', 'tenure']),('cat',OneHotEncoder(handle_unknown='ignore'),['SeniorCitizen', 'gender','Partner', 'Dependents','PhoneService','MultipleLines','InternetService','OnlineSecurity','OnlineBackup','DeviceProtection','TechSupport', 'StreamingTV','StreamingMovies','Contract','PaperlessBilling','PaymentMethod'])])),('classifier',LogisticRegression(class_weight='balanced', max_iter=300))])
ColumnTransformer(transformers=[('num',Pipeline(steps=[('imputer',SimpleImputer(strategy='median')),('std_scaler',StandardScaler())]),['MonthlyCharges', 'TotalCharges', 'tenure']),('cat', OneHotEncoder(handle_unknown='ignore'),['SeniorCitizen', 'gender', 'Partner','Dependents', 'PhoneService', 'MultipleLines','InternetService', 'OnlineSecurity','OnlineBackup', 'DeviceProtection','TechSupport', 'StreamingTV','StreamingMovies', 'Contract','PaperlessBilling', 'PaymentMethod'])])
['MonthlyCharges', 'TotalCharges', 'tenure']
SimpleImputer(strategy='median')
StandardScaler()
['SeniorCitizen', 'gender', 'Partner', 'Dependents', 'PhoneService', 'MultipleLines', 'InternetService', 'OnlineSecurity', 'OnlineBackup', 'DeviceProtection', 'TechSupport', 'StreamingTV', 'StreamingMovies', 'Contract', 'PaperlessBilling', 'PaymentMethod']
OneHotEncoder(handle_unknown='ignore')
LogisticRegression(class_weight='balanced', max_iter=300)
Evaluation Results
You can find the details about evaluation process and the evaluation results.
Metric | Value |
---|---|
accuracy | 0.730305 |
f1 score | 0.730305 |
How to Get Started with the Model
Use the code below to get started with the model.
import joblib
import json
import pandas as pd
clf = joblib.load(churn.pkl)
with open("config.json") as f:
config = json.load(f)
clf.predict(pd.DataFrame.from_dict(config["sklearn"]["example_input"]))
Model Card Authors
This model card is written by following authors:
skops_user
Model Card Contact
You can contact the model card authors through following channels: [More Information Needed]
Citation
Below you can find information related to citation.
BibTeX:
bibtex
@inproceedings{...,year={2020}}