Most Reused Code Snippets/Machine Learning/4_deep_learning_model_performance.py
def plot_performance(history):
    """ 
    Plots the Training and Validation Loss
    
    Attributes
    ----------
    history : Keras History Object
        History.history attribute is a record of training loss values 
        and metrics values at successive epochs, as well as validation 
        loss values and validation metrics values
    """
    len_keys = len(list(history.history.keys()))
    for i in range(0, len_keys/2):  
        metric_to_plot = list(history.history.keys())[i]
        val_metric_to_plot = list(history.history.keys())[i+3]
    plt.plot(range(1, max(history.epoch) + 2), history.history[metric_to_plot], ".:", label="Training loss")
    plt.plot(range(1, max(history.epoch) + 2), history.history[val_metric_to_plot], ".:", label="Validation loss")
    plt.title('Training and Validation Loss')
    plt.xlim([1,max(history.epoch) + 2])
    plt.xticks(range(1, max(history.epoch) + 2))
    plt.legend()
    plt.show()
 
    Plots the Training and Validation Loss
    
    Attributes
    ----------
    history : Keras History Object
        History.history attribute is a record of training loss values 
        and metrics values at successive epochs, as well as validation 
        loss values and validation metrics values
    
Plots the Training and Validation Loss
Attributes

history : Keras History Object
History.history attribute is a record of training loss values
and metrics values at successive epochs, as well as validation
loss values and validation metrics values
Plots the Training and Validation Loss Attributes history : Keras History Object History . history attribute is a record of training loss values and metrics values at successive epochs as well as validation loss values and validation metrics values
def plot_performance(history):
    len_keys = len(list(history.history.keys()))
    for i in range(0, len_keys/2):  
        metric_to_plot = list(history.history.keys())[i]
        val_metric_to_plot = list(history.history.keys())[i+3]
    plt.plot(range(1, max(history.epoch) + 2), history.history[metric_to_plot], ".:", label="Training loss")
    plt.plot(range(1, max(history.epoch) + 2), history.history[val_metric_to_plot], ".:", label="Validation loss")
    plt.title('Training and Validation Loss')
    plt.xlim([1,max(history.epoch) + 2])
    plt.xticks(range(1, max(history.epoch) + 2))
    plt.legend()
    plt.show()
def plot_performance ( history ) : len_keys = len ( list ( history . history . keys ( ) ) ) for i in range ( 0 , len_keys / 2 ) : metric_to_plot = list ( history . history . keys ( ) ) [ i ] val_metric_to_plot = list ( history . history . keys ( ) ) [ i + 3 ] plt . plot ( range ( 1 , max ( history . epoch ) + 2 ) , history . history [ metric_to_plot ] , ".:" , label = "Training loss" ) plt . plot ( range ( 1 , max ( history . epoch ) + 2 ) , history . history [ val_metric_to_plot ] , ".:" , label = "Validation loss" ) plt . title ( 'Training and Validation Loss' ) plt . xlim ( [ 1 , max ( history . epoch ) + 2 ] ) plt . xticks ( range ( 1 , max ( history . epoch ) + 2 ) ) plt . legend ( ) plt . show ( )
Plots the Training and Validation Loss
Attributes
Plots the Training and Validation Loss Attributes
""" 
    Plots the Training and Validation Loss
    
    Attributes
    ----------
    history : Keras History Object
        History.history attribute is a record of training loss values 
        and metrics values at successive epochs, as well as validation 
        loss values and validation metrics values
    """
history