TensorFlow for machine learning 基本模板
来源:互联网 发布:linux 文件上传权限 编辑:程序博客网 时间:2024/06/05 23:43
TensorFlow for machine learning 基本模板
import tensorflow as tfimport os#paramatesW = tf.Variable(tf.zeros([5,1]),name = 'weight')b = tf.Variable(0,name = 'bias')def combine_inputs(X): return tf.mul(X,W)+b# forward propagationdef inference(X): return tf.sigmoid(combine_inputs(X))# cost functiondef loss(X,Y): return tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(combine_inputs(X) , Y) )def train(total_loss) learning_rate = 0.00001 return tf.train.GraidentDescendOptimizer(learning_rate).minimize(total_loss)def evaluate(X): return tf.cast(interence(X)>0.5 , tf.float32)With tf.Session() as sess: tf.initial_all_variables().run() X,Y = inputs() total_loss = loss(X,Y) train_op = train(total_loss) coord = tf.train.Coordinator() threads = tf.train_start_queue_runners(sess = sess ,coord = coord) #actual training loop training_step = 1000 for step in range(training_step): sess.run([train_op]) evaluate(X,Y)
阅读全文
0 0
- TensorFlow for machine learning 基本模板
- TensorFlow: A System for Large-Scale Machine Learning
- Learning Path for Machine Learning
- Software for machine learning
- Mapreduce for Machine Learning
- Mathematics for machine learning
- python for machine-learning
- Resource for Machine Learning
- advice for machine learning
- Open Tools for Machine Learning
- Machine Learning Library for Python
- 特征工程 for machine learning
- Code for Machine Learning Diagnostic
- Machine Learning Pipelines for R
- dual learning for machine translation
- Neural Networks for Machine Learning
- <TensorFlow Machine Learning Cookbook>学习笔记(1.1)
- <TensorFlow Machine Learning Cookbook>学习笔记(1.2)
- 纪中国庆集训 简要题解
- iOS 一次性移除掉NSUserDefaults中所有的数据
- Javascript post JSON
- 2017.10.7 phi的反函数 失败总结
- 成员函数入门
- TensorFlow for machine learning 基本模板
- bzoj 3197: [Sdoi2013]assassin 树哈希+树形dp+费用流
- Android自定义view的基本使用
- Python爬虫之超时设置
- 【实战】4-7 maven的pom文件配置
- 大整数存储和运算
- ExerciseP134
- python高级: 解析式、生成器
- caffe上运行mnist实例---手写数字识别所遇到的问题及解决方案