2018年9月5日
摘要: #classification 分类问题 #例子 分类手写数字0-9 import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data #数据包,如果没有自动下载 number 0 to 9 data mnist = input_data.read_data_sets('MNIST_data',o... 阅读全文
posted @ 2018-09-05 17:00 走丢的蜗牛 阅读(267) 评论(0) 推荐(0) 编辑
摘要: #使用dropout解决overfitting(过拟合)问题 #如果有dropout,在feed_dict的参数中一定要加入dropout的值 import tensorflow as tf from sklearn.datasets import load_digits from sklearn.cross_validation import train_test_split from skl... 阅读全文
posted @ 2018-09-05 12:28 走丢的蜗牛 阅读(701) 评论(0) 推荐(0) 编辑
摘要: 实验结果图: 阅读全文
posted @ 2018-09-05 11:55 走丢的蜗牛 阅读(719) 评论(0) 推荐(0) 编辑
摘要: 生成的tensorboard的graph: 阅读全文
posted @ 2018-09-05 11:39 走丢的蜗牛 阅读(2165) 评论(0) 推荐(0) 编辑
摘要: 附:参考https://www.cnblogs.com/likethanlove/p/6547405.html 通过图可以加深对tensorflow reduction_indices的理解: 阅读全文
posted @ 2018-09-05 10:46 走丢的蜗牛 阅读(528) 评论(0) 推荐(0) 编辑
摘要: #placeholder 传入值 import tensorflow as tf """ tf.Variable:主要在于一些可训练变量(trainable variables),比如模型的权重(weights,W)或者偏执值(bias): 声明时,必须提供初始值; 名称的真实含义,在于变量,也即在真实训练时,其值是会改变的,自然事先需要指定初始值; tf.placehold... 阅读全文
posted @ 2018-09-05 09:33 走丢的蜗牛 阅读(1570) 评论(0) 推荐(0) 编辑
摘要: #Varible 变量的使用 使用变量进行自加 import tensorflow as tf state = tf.Variable(0,name='counter') #定义一个变量,赋值为0,且名字为counter #print(state.name) 打印结果:counter:0 one = tf.constant(1) # 定义一个常量 new_value = tf.add(sta... 阅读全文
posted @ 2018-09-05 09:32 走丢的蜗牛 阅读(353) 评论(0) 推荐(0) 编辑
摘要: #Seesion的两种打开模式 import tensorflow as tf matrix1 = tf.constant([[3,3]])#一行两列的一个矩阵 matrix2 = tf.constant([[2], [2]]) #两行一列的一个矩阵 product = tf.matmul(matrix1 , matrix2) #... 阅读全文
posted @ 2018-09-05 09:31 走丢的蜗牛 阅读(253) 评论(0) 推荐(0) 编辑
摘要: #预测一条y = 0.1x + 0.3的直线 import tensorflow as tf import numpy as np #科学计算模块 ''' tf.random_normal([784, 200]):指生成一个784*200的矩阵 tf.zeros([2,3],int32)==>[[0,0,0],[0,0,0]]两行三列 同理tf.ones,tf.fill(产生一个全... 阅读全文
posted @ 2018-09-05 09:29 走丢的蜗牛 阅读(576) 评论(0) 推荐(0) 编辑