Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

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

Select an option

Save audhiaprilliant/cb7890078629b9e5b27693e47ff2c4f4 to your computer and use it in GitHub Desktop.
End to end machine learning model deployment using flask
# The distribution of loan amount by loan status
# Slice the columns
df_viz_5 = df_train[['LoanAmount', 'Loan_Status']].reset_index(drop = True)
# Map the loan status
df_viz_5['Loan_Status'] = df_viz_5['Loan_Status'].map(
{
0: 'Not default',
1: 'Default'
}
)
# Data viz
plotnine.options.figure_size = (8, 4.8)
(
ggplot(
data = df_viz_5
)+
geom_density(
aes(
x = 'LoanAmount',
fill = 'Loan_Status'
),
color = 'white',
alpha = 0.85
)+
labs(
title = 'The distribution of loan amount by loan status'
)+
scale_fill_manual(
name = 'Loan Status',
values = ['#981220','#80797c'],
labels = ['Default', 'Not Default']
)+
xlab(
'Loan amount'
)+
ylab(
'Density'
)+
theme_minimal()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment