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. html5——动画案例(太阳系)

    太阳系主要利用定位,伪元素 <!DOCTYPE html> <html lang="en"> <head> <meta charset=& ...

  2. JS——tab切换

    排它思想: 1.先让所有的元素恢复默认值 2.再让选中的元素赋专有的值 3.干掉所有人,剩下我一个 <!DOCTYPE html> <html> <head lang=& ...

  3. JS——预解析

    1.排查语法错误 <script> console.log(1; </script> 2.变量提升和函数整体提升 <script> console.log(n1); ...

  4. JS——数组

    concat:连接两个或多个数组,返回被连接数组的一个副本. var arr1 = [12, "你好", "哈哈"] var arr2 = [12, " ...

  5. CSS——盒子居中显示

    嵌套中个的子盒子使用了绝对定位,父盒子使用了相对定位.那么子盒子如何居中显示: 1.距离左偏离50% 2.margin-right子盒子宽度的一半 <!DOCTYPE html> < ...

  6. 配置本地git服务器(gitblit win7)

    title: 配置本地git服务器 date: 2017年3月7日22:43:14 gitblit(不用安装) 进入gitblit-1.8.0\data下,编辑gitblit.properties和d ...

  7. (转) Arcgis for Javascript实现两个地图的联动

    http://blog.csdn.net/gisshixisheng/article/details/40127895 今天在看天地图的时候,有一个多时相的地图显示功能,感觉很好玩,作为技术控的我晚上 ...

  8. js 获取 checkbox[] 值

    $("#btnAdd1").click(function () { console.log($("form").serialize()); var checkb ...

  9. mybatis 简单的入门实例

    第一步:添加mybaties的架包 第二步:配置mybaties的文件 <?xml version="1.0" encoding="UTF-8" ?> ...

  10. CAD在网页中如何得到用户自定义事件的参数?

    主要用到函数说明: _DMxDrawX::CustomEventParam 得到用户自定义事件的参数. js代码实现如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...