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. JS——switch case

    语法: switch(n) { case 1: 执行代码块 1 break; case 2: 执行代码块 2 break; default: n 与 case 1 和 case 2 不同时执行的代码 ...

  2. zTree 模糊搜索

    /** * 搜索树,高亮显示并展示[模糊匹配搜索条件的节点s] * @param treeId * @param searchConditionId 搜索条件Id */ function search ...

  3. DOClever线下部署安装说明文档

    先本地要安装node环境,推荐6.10.0版本 到nodejs官网进行下载window版本进行安装,这里就不做说明了  接下来我们开始安装mongodb,首先下载mongodb  下载完成后我们一路 ...

  4. [转]linux内存管理源码分析 - 页框分配器

    转自: http://www.cnblogs.com/tolimit/ 阅读之前,先敬原作者一杯! 分段和分页 先看一幅图 也就是我们实际中编码时遇到的内存地址并不是对应于实际内存上的地址,我们编码中 ...

  5. vue-router的基本使用和配置

    1.在main.js文件中引入相关模块以及组件及实例化vue对象配置选项路由及渲染App组件 默认设置如下: import Vue from 'vue' import App from './App' ...

  6. P1638 逛画展

    题目描述 博览馆正在展出由世上最佳的 M 位画家所画的图画. wangjy想到博览馆去看这几位大师的作品. 可是,那里的博览馆有一个很奇怪的规定,就是在购买门票时必须说明两个数字, a和b,代表他要看 ...

  7. 最小生成树算法Kruskal详解

    要讲Kruskal,我们先来看下面一组样例. 4 5 1 2 3 1 4 5 2 4 7 2 3 6 3 4 8 14 画出来更直观一些,就是上面的这张图. 智商只要不是0的(了解最小生成树是什么的童 ...

  8. 一、Scrapy入门教程

    本文转载自以下链接:https://scrapy-chs.readthedocs.io/zh_CN/latest/intro/tutorial.html 在本篇教程中,我们假定您已经安装好Scrapy ...

  9. Mac下对Android apk反编译

    在Mac上进行反编译apk,需要三个工具,分别为(附下载地址): apktool,下载Mac版 作用:资源文件获取,能够提取出图片文件和布局文件进行使用查看 dex2jar,下载最新的即可,目前是2. ...

  10. 《ABCD组》第八次作业:ALPHA冲刺

    <ABCD组>第八次作业:ALPHA冲刺 项目 内容 这个作业属于哪个课程 http://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://ww ...