 《Efficient Deep Learning Book》[EDL] Chapter 5 - Advanced Compression Techniqueszero. def sparsify_smallest(w, sparsity_rate): w = w.copy() w_1d = np.reshape(w, (-1)) # Create a list of indices sorted by the absolute magnitude of the weights. w_1d_sorted_indices = np.argsort(np.abs(w_1d)) code prepares the input arguments to create a model for pruning. The prunable_blocks variable is the list of names of prunable convolution blocks. We prune all convolution blocks from second (zero indexed) to the pet segmentation model from chapter four. # Pruning start and end blocks prunable_blocks = list(map(lambda l: l.name, model.layers[2:13])) model_for_pruning = create_model_for_pruning(model, prunable_blocks)0 码力 | 34 页 | 3.18 MB | 1 年前3 《Efficient Deep Learning Book》[EDL] Chapter 5 - Advanced Compression Techniqueszero. def sparsify_smallest(w, sparsity_rate): w = w.copy() w_1d = np.reshape(w, (-1)) # Create a list of indices sorted by the absolute magnitude of the weights. w_1d_sorted_indices = np.argsort(np.abs(w_1d)) code prepares the input arguments to create a model for pruning. The prunable_blocks variable is the list of names of prunable convolution blocks. We prune all convolution blocks from second (zero indexed) to the pet segmentation model from chapter four. # Pruning start and end blocks prunable_blocks = list(map(lambda l: l.name, model.layers[2:13])) model_for_pruning = create_model_for_pruning(model, prunable_blocks)0 码力 | 34 页 | 3.18 MB | 1 年前3
 动手学深度学习 v2.0包含a行和b列的实数矩阵集合 • A ∪ B: 集合A和B的并集 13 • A ∩ B:集合A和B的交集 • A \ B:集合A与集合B相减,B关于A的相对补集 函数和运算符 • f(·):函数 • log(·):自然对数 • exp(·): 指数函数 • 1X : 指示函数 • (·)⊤: 向量或矩阵的转置 • X−1: 矩阵的逆 • ⊙: 按元素相乘 • [·, ·]:连结 • |X|:集合的基数 预备知识 (continued from previous page) return (hasattr(X, "ndim") and X.ndim == 1 or isinstance(X, list) and not hasattr(X[0], "__len__")) if has_one_axis(X): X = [X] if Y is None: X, Y = [[]] * len(X) �→'identity_transform', 'independent', 'kl', 'kl_divergence', 'kumaraswamy', 'laplace', 'lkj_cholesky', �→'log_normal', 'logistic_normal', 'lowrank_multivariate_normal', 'mixture_same_family', 'multinomial',0 码力 | 797 页 | 29.45 MB | 1 年前3 动手学深度学习 v2.0包含a行和b列的实数矩阵集合 • A ∪ B: 集合A和B的并集 13 • A ∩ B:集合A和B的交集 • A \ B:集合A与集合B相减,B关于A的相对补集 函数和运算符 • f(·):函数 • log(·):自然对数 • exp(·): 指数函数 • 1X : 指示函数 • (·)⊤: 向量或矩阵的转置 • X−1: 矩阵的逆 • ⊙: 按元素相乘 • [·, ·]:连结 • |X|:集合的基数 预备知识 (continued from previous page) return (hasattr(X, "ndim") and X.ndim == 1 or isinstance(X, list) and not hasattr(X[0], "__len__")) if has_one_axis(X): X = [X] if Y is None: X, Y = [[]] * len(X) �→'identity_transform', 'independent', 'kl', 'kl_divergence', 'kumaraswamy', 'laplace', 'lkj_cholesky', �→'log_normal', 'logistic_normal', 'lowrank_multivariate_normal', 'mixture_same_family', 'multinomial',0 码力 | 797 页 | 29.45 MB | 1 年前3
 【PyTorch深度学习-龙龙老师】-测试版202112cmd.exe。或者点击开始菜单,输入“cmd”也可搜索到 cmd.exe 程序,打开即可。输入 conda list 命令即可查看 Python 环境已安装的库,如果是新安装的 Python 环境,则列出的 库都是 Anaconda 自带的软件库,如图 1.24 所示。如果 conda list 能够正常弹出一系列的库 列表信息,说明 Anaconda 软件安装成功;如果 conda 命令不能被识别,则说明安装失败, 将 PyTorch 张量的数据导出为 numpy 数组格式 Out[3]: array([1. , 2. , 3.3], dtype=float32) 创建向量、矩阵、张量等,可以通过 List 容器传给 torch.tensor()函数。例如,创建一 个元素的向量,代码如下: In [4]: a = torch.tensor([1.2]) # 创建一个元素的向量 a, a Python List 列表是 Python 程序中非常重要的数据载体容器,很多 数据都是通过 Python 语言将数据加载至 Array 或者 List 容器,再转换到 Tensor 类型,通过 PyTorch 运算处理后导出到 Array 或者 List 容器,方便其他模块调用。 通过 tf.tensor()函数可以创建新 Tensor,并将保存在 Python List 对象或者 Numpy0 码力 | 439 页 | 29.91 MB | 1 年前3 【PyTorch深度学习-龙龙老师】-测试版202112cmd.exe。或者点击开始菜单,输入“cmd”也可搜索到 cmd.exe 程序,打开即可。输入 conda list 命令即可查看 Python 环境已安装的库,如果是新安装的 Python 环境,则列出的 库都是 Anaconda 自带的软件库,如图 1.24 所示。如果 conda list 能够正常弹出一系列的库 列表信息,说明 Anaconda 软件安装成功;如果 conda 命令不能被识别,则说明安装失败, 将 PyTorch 张量的数据导出为 numpy 数组格式 Out[3]: array([1. , 2. , 3.3], dtype=float32) 创建向量、矩阵、张量等,可以通过 List 容器传给 torch.tensor()函数。例如,创建一 个元素的向量,代码如下: In [4]: a = torch.tensor([1.2]) # 创建一个元素的向量 a, a Python List 列表是 Python 程序中非常重要的数据载体容器,很多 数据都是通过 Python 语言将数据加载至 Array 或者 List 容器,再转换到 Tensor 类型,通过 PyTorch 运算处理后导出到 Array 或者 List 容器,方便其他模块调用。 通过 tf.tensor()函数可以创建新 Tensor,并将保存在 Python List 对象或者 Numpy0 码力 | 439 页 | 29.91 MB | 1 年前3
 keras tutorialused to avoid DivideByZero error.  floatx represent the default data type float32. You can also change it to float16 or float64 using set_floatx() method.  backend denotes the current backend. theano By default, keras uses TensorFlow backend. If you want to change backend configuration from TensorFlow to Theano, just change the backend = theano in keras.json file. It is described below: Keras in this chapter. Available modules Let us first see the list of modules available in the Keras.  Initializers: Provides a list of initializers function. We can learn it in details in Keras0 码力 | 98 页 | 1.57 MB | 1 年前3 keras tutorialused to avoid DivideByZero error.  floatx represent the default data type float32. You can also change it to float16 or float64 using set_floatx() method.  backend denotes the current backend. theano By default, keras uses TensorFlow backend. If you want to change backend configuration from TensorFlow to Theano, just change the backend = theano in keras.json file. It is described below: Keras in this chapter. Available modules Let us first see the list of modules available in the Keras.  Initializers: Provides a list of initializers function. We can learn it in details in Keras0 码力 | 98 页 | 1.57 MB | 1 年前3
 PyTorch Release Notesregistry installation documentation based on your platform. ‣ Ensure that you have access and can log in to the NGC container registry. Refer to NGC Getting Started Guide for more information. The deep R418, R440, R460, and R520 drivers, which are not forward- compatible with CUDA 12.1. For a complete list of supported drivers, see the CUDA Application Compatibility topic. For more information, see CUDA Volta™, NVIDIA Turing™, NVIDIA Ampere architecture, and NVIDIA Hopper™ architecture families. For a list of GPUs to which this compute capability corresponds, see CUDA GPUs. For additional support details0 码力 | 365 页 | 2.94 MB | 1 年前3 PyTorch Release Notesregistry installation documentation based on your platform. ‣ Ensure that you have access and can log in to the NGC container registry. Refer to NGC Getting Started Guide for more information. The deep R418, R440, R460, and R520 drivers, which are not forward- compatible with CUDA 12.1. For a complete list of supported drivers, see the CUDA Application Compatibility topic. For more information, see CUDA Volta™, NVIDIA Turing™, NVIDIA Ampere architecture, and NVIDIA Hopper™ architecture families. For a list of GPUs to which this compute capability corresponds, see CUDA GPUs. For additional support details0 码力 | 365 页 | 2.94 MB | 1 年前3
 《Efficient Deep Learning Book》[EDL] Chapter 3 - Learning Techniquesdata. We used an image of the whale to demonstrate the effects of transformations visually. The above list is not exhaustive, rather we have used it as a guide to help make better transformation choices. A unlikely to be the same between two successive pictures. Even though it could be a slight change, it is still a change. The random rotation transformation attempts to simulate that outcome. The random nature LookupError as e: import nltk nltk.download('wordnet') """ It returns a list of synonyms of the input word. The output list may contain the original word. """ def synonyms(word): results = set()0 码力 | 56 页 | 18.93 MB | 1 年前3 《Efficient Deep Learning Book》[EDL] Chapter 3 - Learning Techniquesdata. We used an image of the whale to demonstrate the effects of transformations visually. The above list is not exhaustive, rather we have used it as a guide to help make better transformation choices. A unlikely to be the same between two successive pictures. Even though it could be a slight change, it is still a change. The random rotation transformation attempts to simulate that outcome. The random nature LookupError as e: import nltk nltk.download('wordnet') """ It returns a list of synonyms of the input word. The output list may contain the original word. """ def synonyms(word): results = set()0 码力 | 56 页 | 18.93 MB | 1 年前3
 《Efficient Deep Learning Book》[EDL] Chapter 7 - Automationbuild_hp_model(hp): if hp: learning_rate = hp.Float( "learning_rate", min_value=1e-4, max_value=1e-2, sampling="log" ) dropout_rate = hp.Float( "dropout_rate", min_value=.1, max_value=.8, step=.1 ) return creat {'default': 0.0001, 'conditions': [], 'min_value': 0.0001, 'max_value': 0.01, 'step': None, 'sampling': 'log'} dropout_rate (Float) {'default': 0.1, 'conditions': [], 'min_value': 0.1, 'max_value': 0.8, 'step': the blocks which could produce more complex cells. For primitive operations, NASNet chooses from a list of 13 frequently used operations in convolution networks such as regular convolutions, max pooling0 码力 | 33 页 | 2.48 MB | 1 年前3 《Efficient Deep Learning Book》[EDL] Chapter 7 - Automationbuild_hp_model(hp): if hp: learning_rate = hp.Float( "learning_rate", min_value=1e-4, max_value=1e-2, sampling="log" ) dropout_rate = hp.Float( "dropout_rate", min_value=.1, max_value=.8, step=.1 ) return creat {'default': 0.0001, 'conditions': [], 'min_value': 0.0001, 'max_value': 0.01, 'step': None, 'sampling': 'log'} dropout_rate (Float) {'default': 0.1, 'conditions': [], 'min_value': 0.1, 'max_value': 0.8, 'step': the blocks which could produce more complex cells. For primitive operations, NASNet chooses from a list of 13 frequently used operations in convolution networks such as regular convolutions, max pooling0 码力 | 33 页 | 2.48 MB | 1 年前3
 机器学习课程-温州大学-特征工程score_cat = pd.cut(score_list, bins) print(pd.value_counts(score_cat)) (59, 70] 7 (0, 59] 6 (80, 90] 4 (90, 100] 2 (70, 80] 1 可以按照区间分箱: score_cat = pd.qcut(score_list,5) print(pd.value_counts(score_cat)) 特征构建 相对于聚合特征构造依赖于多个特征的分组统计,通常依赖于对于特征本 身的变换。转换特征构造使用单一特征或多个特征进行变换后的结果作为 新的特征。 常见的转换方法有单调转换(幂变换、log变换、绝对值等)、线性组合、 多项式组合、比例、排名编码和异或值等。 转换特征构造 15 2. 特征构建 • 基于单价和销售量计算销售额. • 基于原价和售价计算利润. • 基于不同月 (?, ?) × ???(?) ??(?, ?) 表示单词 ? 在文档 ? 中出现的频率 ???(?) 是逆文档频率,用来衡量单词 ? 对表达语义所起的重要性,其表示为: ???(?) = log 文章总数 包含单词?的文章总数 + 1 文本特征提取 3. 特征提取 23 许永洪,吴林颖.中国各地区人口特征和房价波动的动态关系[J].统计研究,2019,36(01) 2. N-gram0 码力 | 38 页 | 1.28 MB | 1 年前3 机器学习课程-温州大学-特征工程score_cat = pd.cut(score_list, bins) print(pd.value_counts(score_cat)) (59, 70] 7 (0, 59] 6 (80, 90] 4 (90, 100] 2 (70, 80] 1 可以按照区间分箱: score_cat = pd.qcut(score_list,5) print(pd.value_counts(score_cat)) 特征构建 相对于聚合特征构造依赖于多个特征的分组统计,通常依赖于对于特征本 身的变换。转换特征构造使用单一特征或多个特征进行变换后的结果作为 新的特征。 常见的转换方法有单调转换(幂变换、log变换、绝对值等)、线性组合、 多项式组合、比例、排名编码和异或值等。 转换特征构造 15 2. 特征构建 • 基于单价和销售量计算销售额. • 基于原价和售价计算利润. • 基于不同月 (?, ?) × ???(?) ??(?, ?) 表示单词 ? 在文档 ? 中出现的频率 ???(?) 是逆文档频率,用来衡量单词 ? 对表达语义所起的重要性,其表示为: ???(?) = log 文章总数 包含单词?的文章总数 + 1 文本特征提取 3. 特征提取 23 许永洪,吴林颖.中国各地区人口特征和房价波动的动态关系[J].统计研究,2019,36(01) 2. N-gram0 码力 | 38 页 | 1.28 MB | 1 年前3
 Lecture 3: Logistic Regression/ 29 Logistic Regression Formulation (Contd.) Maximize the log likelihood ℓ(θ) = log L(θ) = m � i=1 � y(i) log h(x(i)) + (1 − y(i)) log(1 − h(x(i)) � Gradient ascent algorithm θj ← θj + α ▽θj ℓ(θ) data {(x(i), y (i))}i=1,··· ,m where y (i) ∈ {1, ..., K} is the label for the sample x(i) Output: A list of classifier fk for k ∈ {1, · · · , K} Procedure: For ∀k ∈ {1, · · · .K}, construct a new label z(i) Regression September 20, 2023 27 / 29 Softmax Regression (Contd.) Log-likelihood function ℓ(θ) = m � i=1 log p(y(i)|x(i); θ) = m � i=1 log K � k=1 � � exp � θ(k)Tx(i)� �K k′=1 exp � θ(k′)Tx(i) �0 码力 | 29 页 | 660.51 KB | 1 年前3 Lecture 3: Logistic Regression/ 29 Logistic Regression Formulation (Contd.) Maximize the log likelihood ℓ(θ) = log L(θ) = m � i=1 � y(i) log h(x(i)) + (1 − y(i)) log(1 − h(x(i)) � Gradient ascent algorithm θj ← θj + α ▽θj ℓ(θ) data {(x(i), y (i))}i=1,··· ,m where y (i) ∈ {1, ..., K} is the label for the sample x(i) Output: A list of classifier fk for k ∈ {1, · · · , K} Procedure: For ∀k ∈ {1, · · · .K}, construct a new label z(i) Regression September 20, 2023 27 / 29 Softmax Regression (Contd.) Log-likelihood function ℓ(θ) = m � i=1 log p(y(i)|x(i); θ) = m � i=1 log K � k=1 � � exp � θ(k)Tx(i)� �K k′=1 exp � θ(k′)Tx(i) �0 码力 | 29 页 | 660.51 KB | 1 年前3
 Keras: 基于 Python 的深度学习库relu(-x) return K.concatenate([pos, neg], axis=1) def antirectifier_output_shape(input_shape): shape = list(input_shape) assert len(shape) == 2 # only valid for 2D tensors shape[-1] *= 2 return tuple(shape) sampling_factor))) 我们假设单词频率遵循 Zipf 定律(s=1),来导出 frequency(rank) 的数值近似: frequency(rank) ~ 1/(rank * (log(rank) + gamma) + 1/2 - 1/(12*rank)), 其 中 gamma 为 Euler-Mascheroni 常量。 参数 • size: 整数,可能采样的单词数量。 y_pred) 7.2.8 logcosh logcosh(y_true, y_pred) 预测误差的双曲余弦的对数。 对于小的 x,log(cosh(x)) 近似等于 (x ** 2) / 2。对于大的 x,近似于 abs(x) - log(2)。这表示’logcosh’ 与均方误差大致相同,但是不会受到偶尔疯狂的错误预测的强烈影响。 Arguments • y_true: 目标真实值的张量。0 码力 | 257 页 | 1.19 MB | 1 年前3 Keras: 基于 Python 的深度学习库relu(-x) return K.concatenate([pos, neg], axis=1) def antirectifier_output_shape(input_shape): shape = list(input_shape) assert len(shape) == 2 # only valid for 2D tensors shape[-1] *= 2 return tuple(shape) sampling_factor))) 我们假设单词频率遵循 Zipf 定律(s=1),来导出 frequency(rank) 的数值近似: frequency(rank) ~ 1/(rank * (log(rank) + gamma) + 1/2 - 1/(12*rank)), 其 中 gamma 为 Euler-Mascheroni 常量。 参数 • size: 整数,可能采样的单词数量。 y_pred) 7.2.8 logcosh logcosh(y_true, y_pred) 预测误差的双曲余弦的对数。 对于小的 x,log(cosh(x)) 近似等于 (x ** 2) / 2。对于大的 x,近似于 abs(x) - log(2)。这表示’logcosh’ 与均方误差大致相同,但是不会受到偶尔疯狂的错误预测的强烈影响。 Arguments • y_true: 目标真实值的张量。0 码力 | 257 页 | 1.19 MB | 1 年前3
共 53 条
- 1
- 2
- 3
- 4
- 5
- 6













