码迷,mamicode.com
首页 > 其他好文 > 详细

Tensorflow流程

时间:2019-04-20 15:40:37      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:ons   机器学习   hold   col   归一化   constant   rap   .bat   inpu   

1. 导入/生成样本数据集

2. 转换和归一化数据

data = tf.nn.batch_norm_with_global_normalization(...)

3. 划分样本数据集为训练样本集、测试样本集和验证样本集

4. 设置机器学习参数(超参数)

learning_rate = 0.01
batch_size = 100
iterations = 1000

5. 初始化变量和占位符

a_var = tf.constant(42)
x_input = tf.placeholder(tf.float32, [None, input_size])
y_input = tf.placeholder(tf.float32, [None, num_classes])

6. 定义模型结构

# 线性模型
y_pred = tf.add(tf.mul(x_input, weight_matrix), b_matrix)

7. 声明损失函数

loss = tf.reduce_mean(tf.square(y_actual - y_pred))

8. 初始化模型和训练模型

with tf.Session(graph=graph) as session:
    ...
    session.run(...)
    ...

9. 评估机器学习模型

10. 调优超参数

11. 发布/预测结果

 

Tensorflow流程

标签:ons   机器学习   hold   col   归一化   constant   rap   .bat   inpu   

原文地址:https://www.cnblogs.com/KresnikShi/p/10741024.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!