X Y_ 資料集 深度學習
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 1 12:24:34 2018
@author: Administrator
"""
import tensorflow as tf
import numpy as np
np.set_printoptions(threshold=np.inf) #全部輸出
SEED = 23455
rdm = np.random.RandomState(SEED)#基於seed產生隨機數
#隨機數返回32行2列的矩陣 表示32組
X = rdm.rand(32,2)
Y_ = [[x1+x2+( rdm.rand()/10.0-0.05)] for (x1, x2) in X]
with tf.Session() as sess:#計算
init_op = tf.global_variables_initializer()#初始化
sess.run(init_op)#初始化
print(rdm)#列印
print(X)#列印
print("Y_:")
print(Y_)
<mtrand.RandomState object at 0x000002928ADE3900>
[[0.83494319 0.11482951]
[0.66899751 0.46594987]
[0.60181666 0.58838408]
[0.31836656 0.20502072]
[0.87043944 0.02679395]
[0.41539811 0.43938369]
[0.68635684 0.24833404]
[0.97315228 0.68541849]
[0.03081617 0.89479913]
[0.24665715 0.28584862]
[0.31375667 0.47718349]
[0.56689254 0.77079148]
[0.7321604 0.35828963]
[0.15724842 0.94294584]
[0.34933722 0.84634483]
[0.50304053 0.81299619]
[0.23869886 0.9895604 ]
[0.4636501 0.32531094]
[0.36510487 0.97365522]
[0.73350238 0.83833013]
[0.61810158 0.12580353]
[0.59274817 0.18779828]
[0.87150299 0.34679501]
[0.25883219 0.50002932]
[0.75690948 0.83429824]
[0.29316649 0.05646578]
[0.10409134 0.88235166]
[0.06727785 0.57784761]
[0.38492705 0.48384792]
[0.69234428 0.19687348]
[0.42783492 0.73416985]
[0.09696069 0.04883936]]
Y_:
[[0.969797861054287], [1.1634604857835003], [1.1942714411690643], [0.5384488448601839], [0.8632760602061649], [0.8339321949148727], [0.9280893354024469], [1.6879345369421652], [0.9036674505700479], [0.512956535191759], [0.7844252375973886], [1.299175094270699], [1.0919817282657285], [1.0880495166868347], [1.1734589741814216], [1.3098158421478576], [1.2387201482616108], [0.8289679938936613], [1.3550486329517144], [1.578666175492443], [0.7524305484165053], [0.7326318868381032], [1.2449966435046544], [0.788097599402105], [1.5577488607336392], [0.3889256997930456], [1.0277860551407527], [0.6104042277890978], [0.8594808823356304], [0.8810757430061307], [1.1456401959033111], [0.1907476486033659]]