In tensorflow get started code:

import tensorflow as tf
import numpy as np features = [tf.contrib.layers.real_valued_column("x", dimension=1)]
estimator = tf.contrib.learn.LinearRegressor(feature_columns=features)
x = np.array([1., 2., 3., 4.])
y = np.array([0., -1., -2., -3.])
input_fn = tf.contrib.learn.io.numpy_input_fn({"x":x}, y, batch_size=4, num_epochs=1000)
estimator.fit(input_fn=input_fn, steps=1000)
estimator.evaluate(input_fn=input_fn)

I know what batch_size means, but what do num_epochs and steps mean respectively when there are only 4 training examples?

        asked Apr 17 '17 at 15:02    
iamabug

124        
 
1                                                                                  
Possible duplicate of What is the difference between steps and epochs?                     – ml4294                 Apr 17 '17 at 15:15                                                                            
                                                                                                                        
I think this is a duplicate of stackoverflow.com/questions/38340311/…. You might find a well-explained answer there.                     – ml4294                 Apr 17 '17 at 15:16                                                                            
                                                                                                                        
Also, check out the documentation: tensorflow.org/api_docs/python/tf/contrib/learn/Trainable                     – Jeff                 Apr 17 '17 at 15:17                                                                            
                                                                                                                        
Thanks. It does help a lot.                     – iamabug                 Apr 18 '17 at 2:42                                                                            
add a comment |                      

2 Answers                                 2

active         oldest         votes
         up vote2down voteaccepted

An epoch means using the whole data you have.

A step means using a single batch data.

So, n_steps = Number of data in single epoch // batch_size.

According to https://www.tensorflow.org/api_docs/python/tf/contrib/learn/Trainable,

  • steps: Number of steps for which to train model. If None, train forever. 'steps' works incrementally. If you call two times fit(steps=10) then training occurs in total 20 steps. If you don't want to have incremental behaviour please set max_steps instead. If set, max_steps must be None.

  • batch_size: minibatch size to use on the input, defaults to first dimension of x. Must be None if input_fn is provided.

tflearn中num_epoch含义就是针对所有样本的一次迭代的更多相关文章

  1. C++/C 宏定义(define)中# ## 的含义(转)

    http://hi.baidu.com/kiraversace/item/1148ee057147981a4ac4a3e9 C++/C 宏定义(define)中# ## 的含义 define 中的#  ...

  2. C++/C 宏定义(define)中# ## 的含义 宏拼接

    C++/C 宏定义(define)中# ## 的含义 define 中的# ## 一般是用来拼接字符串的,但是实际使用过程中,有哪些细微的差别呢,我们通过几个例子来看看. #是字符串化的意思,出现在宏 ...

  3. java中<load-on-startup>含义

    java中 load-on-startup 含义 java中的 load-on-startup 用于表示该servlet是否在servlet容器启动的时候加载. 示例: <load-on-sta ...

  4. java中“/0”含义

    public class Test { public static void main(String[] args) { // 正常情况下,对这个0,tp中储的是其对应的ASCII码48 char t ...

  5. load-on-startup在web.xml中的含义

    在servlet的配置当中,<load-on-startup>1</load-on-startup>的含义是: 标记容器是否在启动的时候就加载这个servlet. 当值为0或者 ...

  6. 推荐一个SAM文件或者bam文件中flag含义解释工具

    SAM是Sequence Alignment/Map 的缩写.像bwa等软件序列比对结果都会输出这样的文件.samtools网站上有专门的文档介绍SAM文件.具体地址:http://samtools. ...

  7. 推荐一个SAM文件中flag含义解释工具--转载

    SAM是Sequence Alignment/Map 的缩写.像bwa等软件序列比对结果都会输出这样的文件.samtools网站上有专门的文档介绍SAM文件.具体地址:http://samtools. ...

  8. 31、SAM文件中flag含义解释工具--转载

    转载:http://www.cnblogs.com/nkwy2012/p/6362996.html  SAM是Sequence Alignment/Map 的缩写.像bwa等软件序列比对结果都会输出这 ...

  9. python3中“->”的含义

    ->:标记返回函数注释,信息作为.__annotations__属性提供 __annotations__属性是字典.键return是用于在箭头后检索值的键.但是在Python中3.5,PEP 4 ...

随机推荐

  1. Burn Down Chart(2018.6.4~2018.6.10)

    Burn Down Chart (2018.6.4~2018.6.10) 娄雨禛[前端部分] 曾子轩[后端部分+燃尽图] 前端 1. 娄雨禛+李鑫 1)在总工程中完成跳转,实现图片显示,并发布到Git ...

  2. JS——设置cookie

    cookie 用来识别用户. <html> <head> <script type="text/javascript"> function ge ...

  3. 1.CentOS安装Redis

    首要条件:安装VMware,在虚拟机中安装CentOS. 第一次接触CentOS的开发者最好是在虚拟机手动一步步进行安装,并且系统环境选择开发环境,这样可以避免后期自己要安装诸多运行库. 安装步骤: ...

  4. C# 执行sql语句批量更新

    int x = db.Database.ExecuteSqlCommand(string.Format("update T_Pension SET UnitType = '{0}' WHER ...

  5. JVM 内存设置大小(Xms Xmx PermSize MaxPermSize 区别)

    Eclipse崩溃,错误提示:MyEclipse has detected that less than 5% of the 64MB of Perm Gen (Non-heap memory) sp ...

  6. 小程序 之picker-view省市县

    代码地址:https://github.com/yangsphp/area-picker

  7. 如何在mac里面,把xcode代码同步到 tfs 的 git库(新git库)

    克隆篇请参考:http://www.cnblogs.com/IWings/p/6744895.html 在mac安装visual studio code https://code.visualstud ...

  8. CAD从二制流数据中加载图形(com接口)

    主要用到函数说明: _DMxDrawX::ReadBinStream 从二制流数据中加载图形,详细说明如下: 参数 说明 VARIANT varBinArray 二制流数据,是个byte数组 BSTR ...

  9. 强大而优雅,API 研发管理 EOLINKER 新版正式发布!

    EOLINKER 于2019年3月3日正式发布新版本!该版本大幅强化各个产品的功能.着重优化了全站的用户交互体验,并且EOLINKER AMS 产品正式更名为 EOLINKER API Studio ...

  10. Luogu P1550 打井Watering Hole

    P1550 [USACO08OCT]打井Watering Hole 题目背景 John的农场缺水了!!! 题目描述 Farmer John has decided to bring water to ...