08 2020 档案

摘要:```python # region 加载库,基础参数配置 # 运行前下载数据集 # wget http://www.fit.vutbr.cz/~imikolov/rnnlm/simple-examples.tgz # tar xvf simple-examples.tgz # 下载PTB,借助re 阅读全文
posted @ 2020-08-30 19:50 kpwong 阅读(586) 评论(0) 推荐(0) 编辑
摘要:我是集训营的学员,我大致分享一下遇到的面试题1. 基础的数据结构:插入排序、选择排序 (记下时间复杂度), 链表新增、删除,二叉树的遍历,其他场景算法题大多出自leetcode2. 逻辑回归损失是什么, 手动推导一遍3. 对集成学习, SVM的理解,以公式的形式写出来最好4. 对HMM ,CRF的理 阅读全文
posted @ 2020-08-30 19:28 kpwong 阅读(1036) 评论(0) 推荐(0) 编辑
摘要:第一种:vocab = dict(Counter(text).most_common(MAX_VOCAB_SIZE-1)) 举例: from collections import Counter colors = ['red', 'blue', 'red', 'green', 'blue', 'bl 阅读全文
posted @ 2020-08-25 17:17 kpwong 阅读(941) 评论(0) 推荐(0) 编辑
摘要:import tensorflow as tfw = tf.constant(1.)x = tf.constant(2.)y = x*wwith tf.GradientTape() as tape: tape.watch([w]) y2 = x*wgrad1 = tape.gradient(y,[w 阅读全文
posted @ 2020-08-15 09:48 kpwong 阅读(3958) 评论(0) 推荐(0) 编辑
摘要:一、softmax函数 softmax用于多分类过程中,它将多个神经元的输出,映射到(0,1)区间内,可以看成概率来理解,从而来进行多分类! 假设我们有一个数组,V,Vi表示V中的第i个元素,那么这个元素的softmax值就是 tensorflwo中举例: 二 信息熵: 在tensorflow中: 阅读全文
posted @ 2020-08-14 17:00 kpwong 阅读(556) 评论(0) 推荐(0) 编辑
摘要:import tensorflow as tffrom tensorflow import kerasdef preprocess(x,y): x = tf.cast(x, dtype = tf.float32) /255. y = tf.cast(y, dtype = tf.int64) y = 阅读全文
posted @ 2020-08-13 17:05 kpwong 阅读(904) 评论(0) 推荐(0) 编辑
摘要:import tensorflow as tffrom tensorflow import kerasfrom tensorflow.keras import datasetsimport osos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'# x: [60k, 28 阅读全文
posted @ 2020-08-12 10:09 kpwong 阅读(211) 评论(0) 推荐(0) 编辑
摘要:from keras import backend as K K.tensorflow_backend._get_available_gpus() from tensorflow.python.client import device_lib import tensorflow as tf prin 阅读全文
posted @ 2020-08-12 09:11 kpwong 阅读(629) 评论(0) 推荐(0) 编辑
摘要:一、从本质上来讲tf.layers.Dense是一个类 tf.layers.dense是一个函数 二、从使用上来讲:Dense分成两步:第一步是定义层的结构;第二步传入数据;a=tf.layers.Dense(20,activation=tf.nn.tanh, name="u")(inputs) d 阅读全文
posted @ 2020-08-11 12:50 kpwong 阅读(1296) 评论(0) 推荐(0) 编辑
摘要:import torchfrom torch import nnlstm = nn.LSTM(input_size=100,hidden_size=20,num_layers=2)print(lstm)x = torch.randn(10,3,100)out,(h,c) = lstm(x)print 阅读全文
posted @ 2020-08-08 15:51 kpwong 阅读(192) 评论(0) 推荐(0) 编辑
摘要:import numpy as npimport torchimport torch.nn as nnimport torch.optim as optimfrom matplotlib import pyplot as pltnum_time_steps = 50input_size = 1hid 阅读全文
posted @ 2020-08-08 15:42 kpwong 阅读(4149) 评论(0) 推荐(1) 编辑
摘要:nn.RNN(input_size, hidden_size, num_layers=1, nonlinearity=tanh, bias=True, batch_first=False, dropout=0, bidirectional=False) 参数说明 input_size输入特征的维度, 阅读全文
posted @ 2020-08-08 12:20 kpwong 阅读(1687) 评论(0) 推荐(1) 编辑
摘要:'''导入库'''import torchimport torch.nn as nnimport torchvisionimport torch.utils.data as Datafrom torch.utils import model_zooimport mathfrom torch.auto 阅读全文
posted @ 2020-08-08 09:08 kpwong 阅读(201) 评论(0) 推荐(0) 编辑

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