Refence: 《Tensorflow machine learning cookbook》 : Declaring Tensors
Packt.TensorFlow.Machine.Learning.Cookbook.2017 笔记
主要应用领域:计算机视觉,语音识别,机器翻译,健康医疗
流行的GPU架构:Nvidia Tesla and Pascal,4G RAM,
GPU软件支持:Nvidia Cuda Toolkit and also v 5.x +
通用十步骤:
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(...)
...
或:
session = tf.Session(graph=graph)
session.run(…)
9.评估模型;在训练集和测试集上。
10.超参数调优;在验证集上
11.应用,部署上线,预测新输出;
http://tensorfly.cn/tfdoc/mltools.html有广泛的机器学习资源介绍。
但tensorflow的api在tensorfly.cn上还没有。可以下一个tensorflow manual,里面包括了tensorflow的基础教程,运作方式和python,c++的api.
图一:模型的各类参数