Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilities :: Validation Prediction Distribution Plots #466

Open
Aylr opened this issue Jan 30, 2018 · 0 comments
Open

Utilities :: Validation Prediction Distribution Plots #466

Aylr opened this issue Jan 30, 2018 · 0 comments

Comments

@Aylr
Copy link
Contributor

Aylr commented Jan 30, 2018

Background

This is how we should be communicating validation output.
Screen Shot 2018-01-29 at 8.25.13 PM.png

Working code from client work

def plot_distributions(df, actual_col, prediction_col, pos_label='Y', neg_label='N', bins=10, threshold=None):
    import seaborn as sns
    import matplotlib.pyplot as plt
    plt.xlim(0, 1)
    
    positives = df.loc[df[actual_col] == pos_label]
    negatives = df.loc[df[actual_col] == neg_label]

    ax = sns.distplot(positives[prediction_col], kde=False, label=pos_label, bins=bins, color='g')
    ax = sns.distplot(negatives[prediction_col], kde=False, label=neg_label, bins=bins, color='b')
    ax.set_title('Distributions of {} for {}'.format(prediction_col, actual_col))
    ax.legend()
    if threshold:
        plt.axvline(x=threshold, color='r')
    plt.show()
@Aylr Aylr added this to the Sprint 40 milestone Jan 30, 2018
@Aylr Aylr self-assigned this Jan 30, 2018
@Aylr Aylr removed this from the Sprint 40 milestone Feb 5, 2018
@Aylr Aylr removed their assignment Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant