Created
May 16, 2022 12:01
-
-
Save audhiaprilliant/b99cd97a7e5c00719bb4d51480123129 to your computer and use it in GitHub Desktop.
End to end machine learning model deployment using flask
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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