Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

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

Select an option

Save audhiaprilliant/b99cd97a7e5c00719bb4d51480123129 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 the dependents
# Data aggregation between loan status and dependents
df_viz_2 = df_train.groupby(['Loan_Status', 'Dependents'])['Loan_ID'].count().reset_index(name = 'Total')
# Map the loan status
df_viz_2['Loan_Status'] = df_viz_2['Loan_Status'].map(
{
0: 'Not default',
1: 'Default'
}
)
# Data viz
plotnine.options.figure_size = (8, 4.8)
(
ggplot(
data = df_viz_2
)+
geom_bar(
aes(
x = 'Dependents',
y = 'Total',
fill = 'Loan_Status'
),
stat = 'identity',
position = 'fill',
width = 0.5
)+
labs(
title = 'The composition of loan status by the dependents',
fill = 'Loan status'
)+
xlab(
'Dependents'
)+
ylab(
'Frequency'
)+
scale_x_discrete(
limits = ['0', '1', '2', '3+']
)+
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