Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

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

Select an option

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