model.py
def plot_top_feats(feature_importances):
    '''
    Plots the top 5 positive drivers of popularity
    and the top 5 negative drivers according to our model
    '''
    plt.figure(figsize=(15,7))

    plt.subplot(121)
    feature_importances.importance.head(5).sort_values(ascending=True).plot(kind='barh')
    plt.ylabel('')
    plt.yticks(size=16)
    plt.xticks([0, 20, 40, 60])

    plt.subplot(122)
    feature_importances.importance.tail(5).sort_values(ascending=True).plot(kind='barh')
    plt.ylabel('')
    plt.yticks(size=16)
    plt.xticks([0, -40, -80, -120, -160])
    plt.tight_layout()

    Plots the top 5 positive drivers of popularity
    and the top 5 negative drivers according to our model
    
Plots the top 5 positive drivers of popularity
and the top 5 negative drivers according to our model
Plots the top 5 positive drivers of popularity and the top 5 negative drivers according to our model
def plot_top_feats(feature_importances):
    plt.figure(figsize=(15,7))
    plt.subplot(121)
    feature_importances.importance.head(5).sort_values(ascending=True).plot(kind='barh')
    plt.ylabel('')
    plt.yticks(size=16)
    plt.xticks([0, 20, 40, 60])
    plt.subplot(122)
    feature_importances.importance.tail(5).sort_values(ascending=True).plot(kind='barh')
    plt.ylabel('')
    plt.yticks(size=16)
    plt.xticks([0, -40, -80, -120, -160])
    plt.tight_layout()
def plot_top_feats ( feature_importances ) : plt . figure ( figsize = ( 15 , 7 ) ) plt . subplot ( 121 ) feature_importances . importance . head ( 5 ) . sort_values ( ascending = True ) . plot ( kind = 'barh' ) plt . ylabel ( '' ) plt . yticks ( size = 16 ) plt . xticks ( [ 0 , 20 , 40 , 60 ] ) plt . subplot ( 122 ) feature_importances . importance . tail ( 5 ) . sort_values ( ascending = True ) . plot ( kind = 'barh' ) plt . ylabel ( '' ) plt . yticks ( size = 16 ) plt . xticks ( [ 0 , - 40 , - 80 , - 120 , - 160 ] ) plt . tight_layout ( )
Plots the top 5 positive drivers of popularity
and the top 5 negative drivers according to our model
Plots the top 5 positive drivers of popularity and the top 5 negative drivers according to our model
'''
    Plots the top 5 positive drivers of popularity
    and the top 5 negative drivers according to our model
    '''
feature_importances