Tensorflow Estimators API使用介绍

TensorFlow Estimator API 教程

在上一篇文章Tensorflow Dataset API详解里面,我们说Datasets API和Estimators API是TensorFlow 1.3开始引入的两个高级API。其中,Estimators API 提供了训练模型、测试模型准确率和生成预测的方法。在这篇文章里面,我准备对Estimator API做一个基本讲解,其中主要内容还是来源于官方文档


首先,还是先看看tensorflow中Estimators API的组成图:


从上图我们可以知道:Estimators分为Pre-made Estimators和custom Estimators两大类。其中,tf.estimator.Estimators是基类(base class),pre-made Estimators是基类的子类,而custom Estimators则是基类的实例(instance)。

Pre-made Estimators和custom Estimators差异主要在于tensorflow中是否有它们可以直接使用的模型函数(model function or model_fn)d的实现。对于前者,tensorflow中已经有写好的model function,因而直接调用即可;而后者的model function需要自己编写。因此,Pre-made Estimators使用方便,但使用范围小,灵活性差;custom Estimators则正好相反。

Your model function could implement a wide range of algorithms, defining all sorts ofhidden layers andmetrics. Like input functions, all model functions must accept a standard group of input parameters and return a standard group of output values. Just as input functions can leverage the Dataset API,model functions can leverage the Layers API and the Metrics API.

总体来说,模型是由三部分构成:Input functions、Model functions  和Estimators(评估控制器,main function)。

  1. Input functions:主要是由Dataset API组成
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值