《Efficient Deep Learning Book》[EDL] Chapter 3 - Learning TechniquesEnglish to Spanish translation model. Let’s dig deeper into each of these categories using examples and code samples. Label Invariant Transformations Label invariant transformations transform samples such These values are clipped to 255. We will discuss some examples of image transformations below. The code samples are provided to bridge the theory and practice gap. We have prepared a few helper functions: image_path = 'file:///whalefin.png' Now, let’s go through the various image transformations with code examples. Rotation rotates the image pixels around the center. It is parameterized by . A positive0 码力 | 56 页 | 18.93 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 6 - Advanced Learning Techniques - Technical Reviewdeployment of such models is the GitHub’s Copilot software9 where GPT-3 is used for auto-completing code snippets with an IDE. End-users can also use GPT-3 API10 to build their own applications. Given the Project: Using Pre-trained Language Models for News Classification That was a lot of talk without any code. Our overarching goal with self-supervised learning is to be more efficient in the number of labels demonstrate better quality and faster convergence than a BERT model that is trained from scratch. The code for this project is available here as a Jupyter notebook. We will not be explicitly demonstrating0 码力 | 31 页 | 4.03 MB | 1 年前3
【PyTorch深度学习-龙龙老师】-测试版202112Anaconda to my PATH environment variable”一项,这样可以通过命令行方式调用 Anaconda 程序。如图 1.23 所示,安装程序 询问是否连带安装 VS Code 软件,选择 Skip 即可。整个安装流程约持续 5 分钟,具体时间 预览版202112 第 1 章 人工智能绪论 18 需依据计算机性能而定。 图 1.22 Anaconda 语言编写程序的方式非常多,可以使用 ipython 或者 ipython notebook 方式 交互式编写代码,也可以利用 Sublime Text、PyCharm 和 VS Code 等综合 IDE 开发中大型 项目。本书推荐使用 PyCharm 编写和调试,使用 VS Code 交互式开发,这两者都可以免费 使用,用户自行下载安装,并配置好 Python 解释器即可。限于篇幅,这里不再赘述。 预览版202112 from matplotlib import pyplot as plt # 绘图工具 from utils import plot_image, plot_curve, one_hot # 便捷绘图函数 batch_size = 512 # 批大小 # 训练数据集,自动从网络下载 MNIST 数据集,保存至 mnist_data 文件夹 train_db=torchvision0 码力 | 439 页 | 29.91 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 2 - Compression Techniqueslearning follow right after. The quantization section delves into the implementation details using code samples. We finish with a hands-on project that will walk you through the process of applying quantization contains the symbol-code mapping is transmitted along with the encoded data. Figure 2-1: Huffman Encoding & Huffman Tree. Source When decoding the encoded data, we look up the code from the lookup table back. Since the codes are unique for each symbol (in fact, they are prefix codes: no code is a prefix of some other code, which eliminates ambiguity when decoding), we can easily construct the original sequence0 码力 | 33 页 | 1.96 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 4 - Efficient Architectures[['efficient deep learning x123!']]).numpy()[0, :4] edl_sequence_output array([ 1, 1379, 1585, 1]) The code snippet above returns indices into the vocabulary we created in the previous step. Let's look up the TFHub14. These embeddings use a 250 dimensional vector to represent a token in the vocabulary. The below code snippet transforms the vocab tokens to their corresponding embeddings. import tensorflow_hub as tfhub word2vec_embeddings tensor should be (vocab_size, embedding_dim), i.e., (5000, 250). The following code snippet will verify that. embedding_dim = 250 # The shape of the word2vec_embeddings would be (vocabulary_size0 码力 | 53 页 | 3.92 MB | 1 年前3
QCon北京2018-《深度学习在微博信息流排序的应用》-刘博+ ?-,.8 ∗ ???? 特征工程 Ø 特征工程非常重要 • 手动组合——专家知识 • categorical特征 • 离散化/归一化处理 • conitnues特征 • one-hot 表示 • 假设检验方式 • 相关系数评估 • 特征组合 • GBDT+互信息——有效挖掘 非线性特征及组合 皮尔逊相关系数特征评估 标签匹配度特征相关系数特征评估 样本采集 Ø 存在问题 features Contextual features Continueous featues Categorical features normalize one-hot encode embedding one-hot encode Content features ReLU(256) ReLU(128) ReLU(64) Cross product transformation normalize one-hot encode embedding Content features ReLU(256) ReLU(128) ReLU(64) FM layer Ø DeepFM模型架构 • Deep part — 泛化力 Deep Output FM Output • FM—低阶特征组合 Logistic loss one-hot encode • End2End框架0 码力 | 21 页 | 2.14 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 7 - Automationtensorflow.keras import layers, losses, optimizers X = tf.random.uniform((20, 5)) Y = tf.squeeze( tf.one_hot(tf.random.uniform((20, 1), 0, 5, tf.int64), 5) ) Now, we choose the trial set, , which contains four after every concatenation operation, we repair channels yet again for standardization. The following code defines a ChildManager class which is responsible for spawning child networks, training them, and self.optimizer.apply_gradients( zip(grads, controller.rnn.trainable_variables) ) The next chunk of code puts everything together and runs the search for 150 episodes. controller = Controller() child_manager0 码力 | 33 页 | 2.48 MB | 1 年前3
Keras: 基于 Python 的深度学习库hashing_trick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 6.2.3 one_hot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 6.2.4 text_to_word_sequence size=(1000, 1)) # 将标签转换为分类的 one-hot 编码 one_hot_labels = keras.utils.to_categorical(labels, num_classes=10) # 训练模型,以 32 个样本为一个 batch 进行迭代 model.fit(data, one_hot_labels, epochs=10, batch_size=32) 我们使用一个共享的 LSTM 层来编码推文。 让我们使用函数式 API 来构建它。首先我们将一条推特转换为一个尺寸为 (140, 256) 的 矩阵,即每条推特 140 字符,每个字符为 256 维的 one-hot 编码(取 256 个常用字符)。 import keras from keras.layers import Input, LSTM, Dense from keras.models import0 码力 | 257 页 | 1.19 MB | 1 年前3
《TensorFlow 快速入门与实战》6-实战TensorFlow验证码识别图像处理:RGB图 -> 灰度图 -> 规范化数据 输入数据处理 适配 Keras 图像数据格式:“channels_frist” 或 “channels_last” 输出数据处理 One-hot 编码:验证码转向量 输出数据处理 解码:模型输出向量转验证码 argmax “Hello TensorFlow” Try it 模型结构设计 分类问题 图像分类模型 AlexNet 是更常用的损失函数,不过他们都是 CE 的变体。 CE 定义如下: 对于二分类问题 (C‘=2) ,CE 定义如下: Categorical CE Loss(Softmax Loss) 常用于输出为 One-hot 向量的多类别分类(Multi-Class Classification)模型。 Binary CE Loss(Sigmoid CE Loss) 与 Softmax Loss 不同,Binary0 码力 | 51 页 | 2.73 MB | 1 年前3
动手学深度学习 v2.0'mixture_same_family', 'multinomial', �→'multivariate_normal', 'negative_binomial', 'normal', 'one_hot_categorical', 'pareto', 'poisson', �→'register_kl', 'relaxed_bernoulli', 'relaxed_categorical', 'studentT' 老年人},那么将这个问题转变为回归问题,并且保留这种格式是 有意义的。 但是一般的分类问题并不与类别之间的自然顺序有关。幸运的是,统计学家很早以前就发明了一种表示分类 数据的简单方法:独热编码(one‐hot encoding)。独热编码是一个向量,它的分量和类别一样多。类别对 应的分量设置为1,其他所有分量设置为0。在我们的例子中,标签y将是一个三维向量,其中(1, 0, 0)对应于 “猫”、(0 AlexNet和LeNet的架构非常相似,如 图7.1.2所示。注意,本书在这里提供的是一个稍微精简版本的AlexNet, 去除了当年需要两个小型GPU同时运算的设计特点。 89 https://code.google.com/archive/p/cuda‐convnet/ 250 7. 现代卷积神经网络 图7.1.2: 从LeNet(左)到AlexNet(右) AlexNet和LeNet的设计理念非常相似,但也存在显著差异。0 码力 | 797 页 | 29.45 MB | 1 年前3
共 32 条
- 1
- 2
- 3
- 4













