如何绘制训练误差和验证误差与时期数的关系图?
how to plot training error and validation error vs number of epochs?
如何绘制训练误差和验证误差与轮数的关系?
train_data = generate_arrays_for_training(indexPat, filesPath, end=75)
validation_data=generate_arrays_for_training(indexPat, filesPath, start=75)
model.fit_generator(generate_arrays_for_training(indexPat, filesPath, end=75), #end=75),#It take the first 75%
validation_data=generate_arrays_for_training(indexPat, filesPath, start=75),#start=75), #It take the last 25%
#steps_per_epoch=10000, epochs=10)
steps_per_epoch=int((len(filesPath)-int(len(filesPath)/100*25))),#*25),
validation_steps=int((len(filesPath)-int(len(filesPath)/100*75))),#*75),
verbose=2,
epochs=300, max_queue_size=2, shuffle=True, callbacks=[callback])
这可能是您要查找的内容,但您应该提供更多详细信息以获得更合适的答案
import matplotlib.pyplot as plt
hist = model.fit_generator(...)
plt.figure()
plt.plot(hist.history['loss'])
plt.plot(hist.history['val_loss'])
plt.title('model loss')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['train','val'], loc = 'upper left')
plt.show()
如何绘制训练误差和验证误差与轮数的关系?
train_data = generate_arrays_for_training(indexPat, filesPath, end=75)
validation_data=generate_arrays_for_training(indexPat, filesPath, start=75)
model.fit_generator(generate_arrays_for_training(indexPat, filesPath, end=75), #end=75),#It take the first 75%
validation_data=generate_arrays_for_training(indexPat, filesPath, start=75),#start=75), #It take the last 25%
#steps_per_epoch=10000, epochs=10)
steps_per_epoch=int((len(filesPath)-int(len(filesPath)/100*25))),#*25),
validation_steps=int((len(filesPath)-int(len(filesPath)/100*75))),#*75),
verbose=2,
epochs=300, max_queue_size=2, shuffle=True, callbacks=[callback])
这可能是您要查找的内容,但您应该提供更多详细信息以获得更合适的答案
import matplotlib.pyplot as plt
hist = model.fit_generator(...)
plt.figure()
plt.plot(hist.history['loss'])
plt.plot(hist.history['val_loss'])
plt.title('model loss')
plt.ylabel('loss')
plt.xlabel('epoch')
plt.legend(['train','val'], loc = 'upper left')
plt.show()