摘要: 一、super的作用 1.如果子类(Puple)继承父类(Person)不做初始化,那么会自动继承父类(Person)属性name。2.如果子类(Puple_Init)继承父类(Person)做了初始化,且不调用super初始化父类构造函数,那么子类(Puple_Init)不会自动继承父类的属性(n 阅读全文
posted @ 2020-06-05 14:49 wigginess 阅读(735) 评论(0) 推荐(1) 编辑
摘要: 2.4损失函数损失函数(loss):预测值(y)与已知答案(y_)的差距 nn优化目标:loss最小->-mse -自定义 -ce(cross entropy)均方误差mse:MSE(y_,y)=E^n~i=1(y-y_)^2/n loss_mse = tf.reduce_mean(tf.squar 阅读全文
posted @ 2020-06-05 11:56 wigginess 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 2.3激活函数sigmoid函数 f(x)= 1/(1 + e^-x)tf.nn.sigmoid(x)特点:(1)求导后的数值在0-0.25之间,链式相乘之后容易使得值趋近于0,形成梯度消失 (2)输出非0均值。收敛慢 (3)幂运算复杂,训练时间长tanh函数 f(x)=(1-e^-2x)/(1+e 阅读全文
posted @ 2020-06-05 11:49 wigginess 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 2.2复杂度和学习率 指数衰减学习率可以先用较大的学习率,快速得到较优解,然后逐步减少学习率,使得模型在训练后期稳定指数衰减学习率 = 初始学习率 * 学习率衰减率^(当前轮数/多少轮衰减一次) 空间复杂度: 层数 = 隐藏层的层数 + 1个输出层 (去掉输入层) 总参数 = 总w + 总b 0 0 阅读全文
posted @ 2020-06-05 11:45 wigginess 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 2.1预备知识 # 条件判断tf.where(条件语句,真返回A,假返回B) import tensorflow as tf a = tf.constant([1,2,3,1,1]) b = tf.constant([0,1,2,4,5]) c = tf.where(tf.greater(a,b), 阅读全文
posted @ 2020-06-05 11:42 wigginess 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 1.5简单神经网络实现过程全览 阅读全文
posted @ 2020-06-05 11:32 wigginess 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 1.4神经网络实现鸢尾花分类 import tensorflow as tf from sklearn import datasets import pandas as pd import numpy as np import matplotlib.pyplot as plt # 数据的读入 x_d 阅读全文
posted @ 2020-06-05 11:07 wigginess 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 1.3鸢尾花数据读入 # 从sklearn包datasets读入数据 from sklearn import datasets from pandas import DataFrame import pandas as pd x_data = datasets.load_iris().data # 阅读全文
posted @ 2020-06-05 10:58 wigginess 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 1.2常用函数 本节目标:掌握在建立和操作神经网络过程中常用的函数 # 常用函数 import tensorflow as tf import numpy as np # 强制Tensor的数据类型转换 x1 = tf.constant([1,2,3],dtype = tf.float64) pri 阅读全文
posted @ 2020-06-05 10:43 wigginess 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 一、简单的神经网络实现过程 1.1张量的生成 # 创建一个张量 #tf.constant(张量内容,dtpye=数据类型(可选)) import tensorflow as tf import numpy as np a = tf.constant([1,5],dtype = tf.int64) p 阅读全文
posted @ 2020-06-05 10:23 wigginess 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 今天我们开始学习tensorflow2.0,用一种简单和循循渐进的方式,带领大家亲身体验深度学习。学习的目录如下图所示: 1.简单的神经网络学习过程 1.1张量生成 1.2常用函数 1.3鸢尾花数据读入 1.4神经网络实现鸢尾花分类 1.5简单神经网络实现过程全览 阅读全文
posted @ 2020-06-05 10:18 wigginess 阅读(114) 评论(0) 推荐(0) 编辑