- 博客(7)
- 收藏
- 关注
原创 常用的激活函数
#activation functionimport numpy as npimport matplotlib.pyplot as pltimport tensorflow as tfx = np.linsoace(-7,7,180)def sigmoid(inputs): y = [ 1 / float(1 + np.exp(-x)) for x in inputs ] re...
2018-03-22 11:01:39
248
原创 梯度下降
梯度下降算是机器学习的核心优化算法了。tensorflow的运算操作import numpy as numpyimport matplotlib.pyplot as pltimport tensorflow as tf#构建数据points_num = 100vectors = []for i in xrange(points_num): x1 = np.random.normal...
2018-03-21 22:41:17
180
原创 matplotlib的使用
import matplotlib.pyplot as pltimport numpy as npx = np.linspace(-4,4,50)y1 = x * 2 +1y2 = x*x + 10#创建第一张图表#plot,画线#figsize:生成图的初始大小plt.figure(num=1,figsize=(7,6))plt.plot(x,y1)plt.plot(x,...
2018-03-21 21:37:58
157
原创 TensorBoard的运用
使用方式:1、用TensorFlow保存图的信息到日志中tf.summary.FileWriter("路径",sess.graph)2、用TensorBoard读取并展示日志tensorboard --logdir=路径TensorBoard图标:eg:tensorboard --logdir=/tmp/hello(要注意的是,浏览器会使用6006端口)import tensorflow as t...
2018-03-21 20:40:12
251
原创 Graph和Session的小案例
import tensorflow as tf#创建一个常量c = tf.constant( [[2,3],[4,5]],name="const1",dtype=int64 )#输出c:<tf.Tensor 'const1:0' shape=(2,2) dtype=int64>#创建会话,需要关闭sess = tf.Session()sess.run(c)''' ...
2018-03-21 17:12:32
231
原创 TensorFlow常用库NumPy
官网教程:https://docs.scipy.org/doc/numpy-dev/user/quickstart.html首先要注意一句话:NumPy’s main object is the homogeneous multidimensional array翻译过来就是,numpy库的主要对象是多维数组,0、1、2、3.....特征:ndarray.ndim:该对象的维度ndarray.sh...
2018-03-21 13:11:23
552
原创 HelloWorld
使用tensorflow库写helloWorldimport tensorflow as tf#创建一个常量hw = tf.constant("Hello World")#启动一个TensorFlow的sessionsess = tf.Session()#运行 Graphprint sess.run(hw)#关闭 Sessionsess.close()运行后,将会显示一句话...
2018-03-21 12:39:17
134
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人