标签:day step proc tensor for TE runners bsp reads
代码如下:
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
for step in range(100):
#获取正真的样本和标签
example, label = sess.run([example_batch, daysOnMarket_batch])
print(‘第%d批数据‘%(step))
print(example, label)
print(‘.......这一批数据的直接参数‘)
reg = linear_model.LinearRegression()
reg.fit(example, label)
print("Coefficients of sklearn: W=%s, b=%f" % (reg.coef_, reg.intercept_))
# 数据归一化处理
scaler = preprocessing.StandardScaler().fit(example)
print(scaler.mean_, scaler.scale_)
x_data_standard = scaler.transform(example)
sess.run(train, feed_dict={x_data: x_data_standard, y_data: label})
# 每十步获取一次w和b
if step % 10 == 0:
print(‘当前w值和b值‘)
print(sess.run(w, feed_dict={x_data: x_data_standard, y_data: label}),
sess.run(b, feed_dict={x_data: x_data_standard, y_data: label}))
print(‘。。。。。。。》》》训练后得到w和b‘)
theta = sess.run(w)
intercept = sess.run(b).flatten()
print(‘W:%s‘ % theta)
print(‘b:%f‘ % intercept)
coord.request_stop()
coord.join(threads)
标签:day step proc tensor for TE runners bsp reads
原文地址:https://www.cnblogs.com/bluesl/p/9215807.html