churn_library.py
def feature_importance_plot(model, x_data, output_pth):
    '''
    creates and stores the feature importances in pth

    input:
        model: model object containing feature_importances_
        x_data: pandas dataframe of X values
        output_pth: path to store the figure

    output:
        None
    '''
    explainer = shap.TreeExplainer(model)
    shap_values = explainer.shap_values(x_data)
    shap.summary_plot(shap_values, x_data, plot_type="bar", show=False)
    plt.savefig(output_pth, bbox_inches='tight')
    plt.clf()

    creates and stores the feature importances in pth

    input:
        model: model object containing feature_importances_
        x_data: pandas dataframe of X values
        output_pth: path to store the figure

    output:
        None
    
creates and stores the feature importances in pth
input:
model: model object containing feature_importances_
x_data: pandas dataframe of X values
output_pth: path to store the figure

None
creates and stores the feature importances in pth input : model : model object containing feature_importances_ x_data : pandas dataframe of X values output_pth : path to store the figure None
def feature_importance_plot(model, x_data, output_pth):
    explainer = shap.TreeExplainer(model)
    shap_values = explainer.shap_values(x_data)
    shap.summary_plot(shap_values, x_data, plot_type="bar", show=False)
    plt.savefig(output_pth, bbox_inches='tight')
    plt.clf()
def feature_importance_plot ( model , x_data , output_pth ) : explainer = shap . TreeExplainer ( model ) shap_values = explainer . shap_values ( x_data ) shap . summary_plot ( shap_values , x_data , plot_type = "bar" , show = False ) plt . savefig ( output_pth , bbox_inches = 'tight' ) plt . clf ( )
creates and stores the feature importances in pth
input:
model: model object containing feature_importances_
x_data: pandas dataframe of X values
output_pth: path to store the figure
creates and stores the feature importances in pth input : model : model object containing feature_importances_ x_data : pandas dataframe of X values output_pth : path to store the figure
'''
    creates and stores the feature importances in pth

    input:
        model: model object containing feature_importances_
        x_data: pandas dataframe of X values
        output_pth: path to store the figure

    output:
        None
    '''
model
x_data
output_pth