一个简单的python包来打印keras nn训练历史。

plot-keras-histor的Python项目详细描述


Travis CI buildSonarCloud QualitySonarCloud MaintainabilityCodacy MaintainabilityPypi projectPypi total project downloads

一个python包,用于打印Keras model training history

如何安装此软件包?

像往常一样,只需使用pip:

pip install plot_keras_history

测试覆盖率

由于某些软件处理覆盖有时会得到稍有不同的结果,下面是其中的三个:

Coveralls CoverageSonarCloud CoverageCode Climate Coverate

用法

假设您有一个由函数my keras生成的模型:

绘制培训历史

在下面的示例中,我们将了解如何绘制、显示或保存培训历史记录:

standard

fromplot_keras_historyimportplot_historyimportmatplotlib.pyplotaspltmodel=my_keras_model()history=model.fit(...).historyplot_history(history)plt.show()plot_history(history,path="standard.png")plt.close()

绘制成单独的图形

默认情况下,这些图都在一个大图像中,但出于各种原因,您可能需要逐个使用它们:

fromplot_keras_historyimportplot_historyimportmatplotlib.pyplotaspltmodel=my_keras_model()history=model.fit(...).historyplot_history(history,path="singleton",single_graphs=True)plt.close()

用savgol滤波器降低历史噪声

在某些情况下,必须能够看到历史的进展,以便对结果进行插值以消除一点噪声。提供了一个参数来自动应用savgol过滤器:

interpolated

fromplot_keras_historyimportplot_historyimportmatplotlib.pyplotaspltmodel=my_keras_model()history=model.fit(...).historyplot_history(history,path="interpolated.png",interpolate=True)plt.close()

自动别名

许多指标会自动从默认指标转换为更具说服力的指标,例如“lr”变为“learning rate”,或“acc”变为“accurity”。

所有可用选项

defplot_history(history,# Either the history object or a pandas DataFrame. When using a dataframe, the index name is used as abscissae label.style:str="-",# The style of the lines.interpolate:bool=False,# Wethever to interpolate or not the graphs datapoints.side:float=5,# Dimension of the graphs side.graphs_per_row:int=4,# Number of graphs for each row.customization_callback:Callable=None,# Callback for customizing the graphs.path:str=None,# Path where to store the resulting image or images (in the case of single_graphs)single_graphs:bool=False#  Wethever to save the graphs as single of multiples.)

链接历史

停止并重新启动模型的训练是很常见的,这会将history对象分成两部分:因此可以使用方法chain_histories

fromplot_keras_historyimportchain_historiesmodel=my_keras_model()history1=model.fit(...).historyhistory2=model.fit(...).historyhistory=chain_histories(history1,history2)

额外费用

extra_keras_metrics

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Eclipse内存分析器(MAT):不显示当前正在运行的进程   java Apache Velocity:转义字符不能作为关联数组键用于PHP   不截断零的java格式十进制输出   在另一个类文件中调用时返回空值的java getter   java集合获取连接   java解析json使用Gson登录系统应用程序强制关闭   java DelferredResult带有两个请求的ajax请求   java可降低功耗,同时应使用无线   java BoxLayout无法共享错误?   java如何使用计时器制作闹钟   java使用OAuth2保护RESTWeb服务:一般原则   java在一个jframe上显示多个图像和按钮