上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 29 下一页
摘要: import tensorflow as tf logits = tf.random.uniform([1,10],minval=-2,maxval=2) print('logits:',logits) prob = tf.nn.softmax(logits) print('softmax后:',p 阅读全文
posted @ 2020-08-15 17:49 山…隹 阅读(834) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf x = tf.random.normal((2,3)) # 模拟样本数据 model = tf.keras.Sequential([ # 定义全连接层结构 tf.keras.layers.Dense(4,activation='relu'), # 第一 阅读全文
posted @ 2020-08-15 17:45 山…隹 阅读(587) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf from tensorflow.keras import optimizers,layers # 定义数据预处理函数 def preprocess(x,y): x = tf.cast(x,dtype=tf.float32) / 255 # 将特征数据转 阅读全文
posted @ 2020-08-12 18:51 山…隹 阅读(722) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf a = tf.random.normal([3,3]) print('初始a:',a) mask = a > 0 print('mask:',mask) bool_mask = tf.boolean_mask(a,mask) print('bool_m 阅读全文
posted @ 2020-08-12 15:52 山…隹 阅读(520) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf import numpy as np from tensorflow.keras import datasets, layers, optimizers # 加载手写数字数据 mnist = tf.keras.datasets.mnist (train 阅读全文
posted @ 2020-08-09 18:51 山…隹 阅读(288) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf import numpy as np import matplotlib.pylab as plt plt.rcParams["font.family"] = 'SimHei' # 将字体改为中文 plt.rcParams['axes.unicode_ 阅读全文
posted @ 2020-08-09 11:39 山…隹 阅读(503) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf import numpy as np import pandas as pd import matplotlib.pylab as plt import matplotlib as mpl # 读取数据集 TRIN_URL = 'http://down 阅读全文
posted @ 2020-08-04 20:24 山…隹 阅读(474) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf import numpy as np import matplotlib.pylab as plt # 模拟数据 x = np.array( [137.97, 104.50, 100, 126.32, 79.20, 99.00, 124.0, 114. 阅读全文
posted @ 2020-08-04 16:21 山…隹 阅读(692) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf import numpy as np x = np.array([1, 2, 3, 4]) y = np.array([0,0,1,1]) w = tf.Variable(1.) b = tf.Variable(1.) sigmodX = 1 / (1 阅读全文
posted @ 2020-08-04 15:17 山…隹 阅读(500) 评论(0) 推荐(0) 编辑
摘要: 平方损失函数求导后,偏导太小,迭代更新慢,a56爆大奖在线娱乐考虑用交叉熵损失函数(注意标记值和预测值不能写反了)(标记值为0或1,对0取对数是不存在的额): 交叉熵损失函数满足作为损失函数的两大规则:非负性,单调一致性 阅读全文
posted @ 2020-08-04 14:38 山…隹 阅读(1170) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 29 下一页