莫烦TensorFlow_07 tensorboard可视化
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt def add_layer(inputs, in_size, out_size, activation_function = None): with tf.name_scope('layer'): with tf.name_scope('Weights'):
Weights = tf.Variable(tf.random_normal([in_size, out_size]), name='W') # hang lie with tf.name_scope('biases'):
biases = tf.Variable(tf.zeros([1, out_size]) + 0.1, name = 'b') with tf.name_scope('Wx_plus_b'):
Wx_plus_b = tf.matmul(inputs, Weights) + biases if activation_function is None:
outputs = Wx_plus_b
else:
outputs = activation_function(Wx_plus_b)
return outputs #define placeholder
with tf.name_scope('inputs'):
xs = tf.placeholder(tf.float32, [None, 1], name = 'x_input')
ys = tf.placeholder(tf.float32, [None, 1], name = 'y_input') #add hidden layer
l1 = add_layer(xs, 1, 10, activation_function = tf.nn.relu)
#add output layer
prediction = add_layer(l1, 10, 1, activation_function = None) #the error between prediction and real data
with tf.name_scope('loss'):
loss = tf.reduce_mean(tf.reduce_sum(tf.square(ys - prediction),
reduction_indices=[1] ))
with tf.name_scope('train'):
train_step = tf.train.GradientDescentOptimizer(0.1).minimize(loss) sess = tf.Session()
writer = tf.summary.FileWriter("logs/", sess.graph) #import step
sess.run(tf.global_variables_initializer() )
注意:有些浏览器可能支持的不好,推荐使用最新的Chrome
命令行输入:
tensorboard --logdir=logs/
莫烦TensorFlow_07 tensorboard可视化的更多相关文章
- 莫烦TensorFlow_08 tensorboard可视化进阶
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt # # add layer # def add_l ...
- 莫烦TensorFlow_06 plot可视化
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt def add_layer(inputs, in_ ...
- 莫烦大大TensorFlow学习笔记(9)----可视化
一.Matplotlib[结果可视化] #import os #os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf i ...
- tensorflow学习笔记-bili莫烦
bilibili莫烦tensorflow视频教程学习笔记 1.初次使用Tensorflow实现一元线性回归 # 屏蔽警告 import os os.environ[' import numpy as ...
- tensorflow 莫烦教程
1,感谢莫烦 2,第一个实例:用tf拟合线性函数 import tensorflow as tf import numpy as np # create data x_data = np.random ...
- Tensorflow 搭建神经网络及tensorboard可视化
1. session对话控制 matrix1 = tf.constant([[3,3]]) matrix2 = tf.constant([[2],[2]]) product = tf.matmul(m ...
- scikit-learn学习笔记-bili莫烦
bilibili莫烦scikit-learn视频学习笔记 1.使用KNN对iris数据分类 from sklearn import datasets from sklearn.model_select ...
- 莫烦pytorch学习笔记(八)——卷积神经网络(手写数字识别实现)
莫烦视频网址 这个代码实现了预测和可视化 import os # third-party library import torch import torch.nn as nn import torch ...
- Tensorflow学习笔记3:TensorBoard可视化学习
TensorBoard简介 Tensorflow发布包中提供了TensorBoard,用于展示Tensorflow任务在计算过程中的Graph.定量指标图以及附加数据.大致的效果如下所示, Tenso ...
随机推荐
- LG1337 [JSOI2004]平衡点 / 吊打XXX 模拟退火
问题描述 LG1337 题解 模拟退火模板 记住概率公式: \(exp(\frac{dealt}{T}) \times rand \ge R_A^ND^M_AX\) zzk太欧了,我交了一版没过他来了 ...
- insertAdjacentHTML和insertAdjacentText的使用(在指定位置插入代码或者文字)
insertAdjacentText方法与insertAdjacentHTML方法类似,只不过只能插入纯文本,参数相同.
- Linux学习笔记-第16天 这些个配置参数好饶阿
原理是懂了,但是配置参数好多阿,难道这些都要记么...呃
- keras.preprocessing.text.Tokenizer
说明:num_words的参数设置,对应着sequences_to_matrix方法返回的arrray的shape[1],用于约束返回数组的第2个维度.对texts_to_sequences(text ...
- VS2019 远程调试
碰到一个问题,在本机调试没有任何问题,部署到测试环境的CentOS 7 上,抛出异常.为解决这个问题,使用远程调试. 第一步,设置远程链接 第二步,Debug--Attach to Process ...
- Azure ARM (23) Azure Policy使用
<Windows Azure Platform 系列文章目录> 在之前的文档中,我们介绍了Azure Policy的使用场景. 本章我们介绍如何创建和使用Azure Policy. 模拟场 ...
- Linux和windows下修改tomcat内存
原文地址:https://www.cnblogs.com/wdpnodecodes/p/8036333.html 由于服务器上放的tomcat太多,造成内存溢出. 常见的内存溢出有以下两种: java ...
- iOS13 新特性简介
目录 一.Dark Mode 暗黑模式 二.Status Bar更新 三.UIActivityIndicatorView加载视图 四.总结 一.Dark Mode 暗黑模式 1.1 iOS13推出了D ...
- poj-2935 BFS Basic Wall Maze
Basic Wall Maze Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 3384 Accepted: 1525 ...
- bootstrap中的col-md-*
一句话概括,就是根据显示屏幕宽度的大小,自动的选用对应的类的样式 1.col是column简写:列 2.xs是maxsmall简写:超小, sm是small简写:小, md是medium简写:中等, ...