亲爱得xin的数据之旅

爱生活,爱旅行的一只数据入门代码狗

0
推荐
1291
阅读

tensorflow 基础模型应用4 —— 卷积神经网络 【转】

v1.convolutional_networkfrom __future__ import print_function import tensorflow as tf # Import MNIST data from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) # Parameters learning_rate = 0.001 training_iters = 200000 batch_si...

发表了文章 • 2016-10-26 17:58 • 0 条评论

0
推荐
984
阅读

tensorflow 基础模型应用3 —— k-means 【转】

1.create样本import tensorflow as tf import numpy as np def create_samples(n_clusters, n_samples_per_cluster, n_features, embiggen_factor, seed): np.random.seed(seed) slices = [] centroids = [] # Create samples for each cluster for i in range(n_clusters): samples = tf...

发表了文章 • 2016-10-25 13:46 • 0 条评论

0
推荐
907
阅读

tensorflow 基础模型应用2 —神经网络 【转自github+整理】

1.神经网络import tensorflow as tf import numpy as np import input_data def init_weights(shape): return tf.Variable(tf.random_normal(shape, stddev=0.01)) def model(X, w_h, w_o): h = tf.nn.sigmoid(tf.matmul(X, w_h)) # this is a basic mlp, think 2 stacked logistic regressions return ...

发表了文章 • 2016-10-24 17:24 • 0 条评论

0
推荐
2740
阅读

tensorflow 基础模型应用1 ——回归 【转自github+整理】

1.一元线性回归import tensorflow as tf import numpy as np trx = np.linspace(-1,1,101) #np.linspace(2.0, 3.0, num=5) array([ 2. , 2.25, 2.5 , 2.75, 3. ]) try = 2*trx + np.random.randn(*trx.shape)*0.33 ## 构建y,近似线性但又有很多噪音 X = tf.placeholder("float") Y = tf.placeholder("fl...

发表了文章 • 2016-10-24 13:30 • 0 条评论

1
推荐
1452
阅读

tensorflow 基础操作 [转自github]

1.导入库import tensorflow as tf2.基础操作# The value returned by the constructor represents the output # of the Constant op.a=tf.constant(2) b=tf.constant(3)3.launch the default graphwith tf.Session() as sess: print "a=2, b=3" print "Addition with constants: %i" % sess.run(a+b) print ...

发表了文章 • 2016-10-24 09:28 • 0 条评论