sklearn管道+ keras顺序模型-如何获取历史记录? [英] sklearn pipeline + keras sequential model - how to get history?

查看:94
本文介绍了sklearn管道+ keras顺序模型-如何获取历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Keras 模型,当调用.fit时,返回历史对象.如果我将此模型用作sklearn管道的一个步骤,是否可以检索它? 顺便说一句,我正在使用python 3.6

Keras models, when .fit is called, return a history object. Is it possible to retrieve it if I use this model as one step of a sklearn pipeline? btw, i'm using python 3.6

提前谢谢!

推荐答案

历史记录"回调记录每个时期的训练指标.这包括损失和准确性(针对分类问题),以及验证数据集的损失和准确性(如果已设置).

The History callback records training metrics for each epoch. This includes the loss and the accuracy (for classification problems) as well as the loss and accuracy for the validation dataset, if one is set.

历史记录对象从对用于训练模型的fit()函数的调用中返回.度量标准存储在返回对象的历史记录成员中的字典中.

The history object is returned from calls to the fit() function used to train the model. Metrics are stored in a dictionary in the history member of the object returned.

这也意味着值必须在fit()函数或顺序模型的范围内,因此,如果它在sklearn管道中,则它无权访问最终值,并且可以不能存储或退回看不见的东西.

This also means that the values have to be in the scope of the fit() function or the sequential model, so if it is in a sklearn pipeline, it doesn't have access to the final values, and it can't store, or return what it can't see.

截至目前,我还不知道sklearn中的历史记录回调,因此对您来说,我唯一看到的是手动记录要跟踪的指标.一种方法是让管道返回数据,然后简单地将模型拟合到该数据上.如果您无法找出答案.

As of right now I an not aware of a history callback in sklearn so the only I see for you is to manually record the metrics you want to track. One way to do so would be to have pipeline return the data and then simply fit your model onto it. If you are not able to figure that out comment.

这篇关于sklearn管道+ keras顺序模型-如何获取历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆