Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save audhiaprilliant/7a2b8b35658f1f4f72aee75f9541dfe8 to your computer and use it in GitHub Desktop.

Select an option

Save audhiaprilliant/7a2b8b35658f1f4f72aee75f9541dfe8 to your computer and use it in GitHub Desktop.
End to end machine learning model deployment using flask
# Number of customers by loan status and educations
# Data aggregation between loan status and dependents
df_viz_3 = df_train.groupby(['Loan_Status', 'Education'])['Loan_ID'].count().reset_index(name = 'Total')
# Map the loan status
df_viz_3['Loan_Status'] = df_viz_3['Loan_Status'].map(
{
0: 'Not default',
1: 'Default'
}
)
# Data viz
plotnine.options.figure_size = (8, 4.8)
(
ggplot(
data = df_viz_3
)+
geom_bar(
aes(
x = 'Education',
y = 'Total',
fill = 'Loan_Status'
),
stat = 'identity',
position = 'fill',
width = 0.5
)+
labs(
title = 'Number of customers by loan status and educations',
fill = 'Loan status'
)+
xlab(
'Educations'
)+
ylab(
'Frequency'
)+
scale_x_discrete(
limits = ['Graduate', 'Not Graduate']
)+
scale_fill_manual(
values = ['#981220','#80797c'],
labels = ['Default', 'Not Default']
)+
theme_minimal()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment