How to use test_history_list method in stestr

Best Python code snippet using stestr_python

graph.py

Source:graph.py Github

copy

Full Screen

1from keras.models import load_model2from keras.datasets import mnist3import matplotlib.pyplot as plt4from PIL import Image, ImageFilter5import numpy as np6import pickle7import keras8import time9import sys10train_loss_list = []11train_acc_list = []12test_loss_list = []13test_acc_list = []14model = load_model('./cnn/model1.h5')15train_history_list = pickle.load(open('./data/train.pkl', 'rb'))16test_history_list = pickle.load(open('./data/test.pkl', 'rb'))17print(type(train_history_list))18print(train_history_list)19train_loss_list = [train_history['loss'] for train_history in train_history_list]20train_acc_list = [train_history['accuracy'] for train_history in train_history_list]21test_loss_list = [test_history[0] for test_history in test_history_list]22test_acc_list = [test_history[1] for test_history in test_history_list]23# 4.2 (a), (b)24plt.figure()25plt.title('Model:1, Loss Graph, Epoch 1-5')26plt.plot(train_loss_list, marker='o', label='Training Set')27plt.plot(test_loss_list, marker='o', label='Test Set')28plt.xticks(np.arange(0, 5), np.arange(1, 7))29plt.legend(loc='upper right')30plt.ylabel('Loss')31plt.xlabel('Epoch')32# 4.2 (c), (d)33plt.figure()34plt.title('Model1 , Accuracy Graph, Epoch 1-5')35plt.plot(train_acc_list, marker='o', label='Training Set')36plt.plot(test_acc_list, marker='o', label='Test Set')37plt.xticks(np.arange(0, 5), np.arange(1, 7))38plt.legend(loc='lower right')39plt.ylabel('Accuracy')40plt.xlabel('Epoch')41#Rotation42test_rot_list = pickle.load(open('./rot/rotate.pkl', 'rb'))43test_rot_acc = [test_rot[1] for test_rot in test_rot_list]44plot_label = 'Model1'45plt.figure()46plt.plot(test_rot_acc, marker='o', label=plot_label)47plt.xticks(np.arange(0, 8), np.arange(-40, 40, step=10))48plt.legend(loc='upper left')49plt.ylabel('Test Accuracy')50plt.xlabel('Degree of Rotation')51# Gaussian Noise52test_blur_list = pickle.load(open('./blur/blurred.pkl', 'rb'))53test_blur_acc = [test_blur[1] for test_blur in test_blur_list]54plot_label = 'Model1'55blur_list = [0.01, 0.1, 1]56plt.figure()57plt.bar(np.arange(len(blur_list)), test_blur_acc, align='center', alpha=0.5)58plt.xticks(np.arange(len(blur_list)), blur_list)59plt.xlabel('Gaussian Noise variance')60plt.ylabel('Test accuracy')...

Full Screen

Full Screen

test_ui_historylist.py

Source:test_ui_historylist.py Github

copy

Full Screen

1from clipmanager.ui.historylist import HistoryListView2def test_history_list(qtbot, model):3 history_view = HistoryListView()4 history_view.setModel(model)5 history_view.show()6 qtbot.addWidget(history_view)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stestr automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful