08 2020 档案

摘要:实时的显示相关数据的图 import tensorflow as tf import datetime def preporocess(x,y): x = tf.cast(x,dtype=tf.float32) / 255 x = tf.reshape(x,(-1,28 *28)) # 铺平 x = 阅读全文
posted @ 2020-08-20 18:04 山…隹 阅读(229) 评论(0) 推荐(0) 编辑
摘要:进入项目路径 输入“ tensorboard --logdir 文件夹名 ” 监听该文件夹 代码中编写将数据写入本地: 1. 标量数据写入: 2. 图片数据写入: 结果展示: 多张图片显示(直接传入多张图片): 多张图片(将多张图片转化为1张图片)数据写入: 结果展示: import tensorf 阅读全文
posted @ 2020-08-20 17:47 山…隹 阅读(1902) 评论(0) 推荐(1) 编辑
摘要:import tensorflow as tf def preporocess(x,y): x = tf.cast(x,dtype=tf.float32) / 255 x = tf.reshape(x,(-1,28 *28)) # 铺平 x = tf.squeeze(x,axis=0) # prin 阅读全文
posted @ 2020-08-16 18:45 山…隹 阅读(625) 评论(0) 推荐(0) 编辑
摘要:import tensorflow as tf a = tf.losses.categorical_crossentropy([0,1,0,0],[0.25,0.25,0.25,0.25],from_logits=True) # 前一个参数为标记值,后一个参数为预测值,最后一个参数设为True,输出 阅读全文
posted @ 2020-08-16 11:20 山…隹 阅读(368) 评论(0) 推荐(0) 编辑
摘要: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 山…隹 阅读(840) 评论(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 山…隹 阅读(593) 评论(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 山…隹 阅读(741) 评论(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 山…隹 阅读(537) 评论(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 山…隹 阅读(290) 评论(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 山…隹 阅读(516) 评论(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 山…隹 阅读(485) 评论(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 山…隹 阅读(696) 评论(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 山…隹 阅读(506) 评论(0) 推荐(0) 编辑
摘要:平方损失函数求导后,偏导太小,迭代更新慢,所以考虑用交叉熵损失函数(注意标记值和预测值不能写反了)(标记值为0或1,对0取对数是不存在的额): 交叉熵损失函数满足作为损失函数的两大规则:非负性,单调一致性 阅读全文
posted @ 2020-08-04 14:38 山…隹 阅读(1205) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-08-04 12:15 山…隹 阅读(291) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示