Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Keras loss plot

model_history = model.fit(...)

def plot_performance(model_history):
    # modle performance visualization
    # subplot
    fig,(ax1, ax2) = plt.subplots(1, 2, figsize=(18, 8))

    # accuracy
    ax1.plot(model_history.history['accuracy'], color='red')
    ax1.plot(model_history.history['val_accuracy'], color='green')
    ax1.set_title('Model accuracy')
    ax1.set_ylabel('Accuracy')
    ax1.set_xlabel('Epoch')
    ax1.legend(['train', 'validation'], loc='lower right')

    # "Loss"
    ax2.plot(model_history.history['loss'], color='red')
    ax2.plot(model_history.history['val_loss'], color='green')
    ax2.set_title('Model loss')
    ax2.set_ylabel('Loss')
    ax2.set_xlabel('Epoch')
    ax2.legend(['train', 'validation'], loc='upper right')
    plt.show()
    
plot_performance(model_history)
Comment

PREVIOUS NEXT
Code Example
Python :: list of dict to dict python 
Python :: check if string match regex python 
Python :: lowercase python 
Python :: python spawn process 
Python :: lambda in python 
Python :: pandas dataframe from list how to make the date column an index 
Python :: __dict__ python? 
Python :: get index of dataframe 
Python :: is fastapi better than flask 
Python :: else if python 
Python :: snake water gun game in python 
Python :: python list to dataframe as row 
Python :: extract value from tensor pytorch 
Python :: defaultdict python 
Python :: python tuple get index of element 
Python :: pdf to string python 
Python :: web scraping using python code 
Python :: tic-tac toe in pygame 
Python :: pandas cummin 
Python :: quantile-quantile plot python 
Python :: How to count the occurrence of certain item in an ndarray? 
Python :: twitter api python 
Python :: open a python script on click flask 
Python :: cholesky decomposition in python 
Python :: return function python 
Python :: python implementation of Min Heap 
Python :: pd.concat has nan 
Python :: how to post data to foreign key in django rest framework 
Python :: python how to make integer show 2 numbers 
Python :: how to add a list in python 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =