Lecture 5: Gaussian Discriminant Analysis, Naive BayesGDA, NB and EM September 27, 2023 6 / 122 Conditional Probability (Contd.) Real valued random variable is a function of the outcome of a ran- domized experiment X : S → R Examples: Discrete random variables valued random variable is a function of the outcome of a ran- domized experiment X : S → R For continuous random variable X P(a < X < b) = P({s ∈ S : a < X(s) < b}) For discrete random variable X P(X = Distribution Probability distribution for discrete random variables Suppose X is a discrete random variable X : S → A Probability mass function (PMF) of X: the probability of X = x pX(x) = P(X = x) Since0 码力 | 122 页 | 1.35 MB | 1 年前3
Keras: 基于 Python 的深度学习库super(MyLayer, self).__init__(**kwargs) def build(self, input_shape): # Create a trainable weight variable for this layer. self.kernel = self.add_weight(name='kernel', shape=(input_shape[1], self.output_dim) inputs = K.placeholder(ndim=3) 下面的代码实例化一个变量。它等价于 tf.Variable() 或 th.shared()。 import numpy as np val = np.random.random((3, 4, 5)) var = K.variable(value=val) # 全 0 变量: var = K.zeros(shape=(3, 4, 5)) 使用随机数初始化张量 b = K.random_uniform_variable(shape=(3, 4), low=0, high=1) # 均匀分布 c = K.random_normal_variable(shape=(3, 4), mean=0, scale=1) # 高斯分布 d = K.random_normal_variable(shape=(3, 4), mean=0, scale=1)0 码力 | 257 页 | 1.19 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 5 - Advanced Compression Techniquesa sample 2D weight matrix with randomly initialized float values. We also define a sparsity_rate variable initialized with the value 0.4 to sparsify 40% of the total number of weights. Finally, we compute that you are convinced that sparsity helps with improving compression. Increasing the sparsity_rate variable’s value will further reduce the size of the sparsified and compressed size. To take a step back 5-2 uses a fixed pruning rate $$p$$. However, we could use variable pruning rates across the pruning rounds. The motivation behind using variable sparsity is that a pre-trained model’s weights will get disrupted0 码力 | 34 页 | 3.18 MB | 1 年前3
全连接神经网络实战. pytorch 版. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.1 自定义 Variable 数据与网络训练 19 4.2 准确率的可视化 22 4.3 分类结果的可视化 23 4.4 自定义 Dataset 数据集 25 3 4.5 总结 27 Literature . chapter3-3.py。 4. 构建自己的数据集 4.1 自定义 Variable 数据与网络训练 19 4.2 准确率的可视化 22 4.3 分类结果的可视化 23 4.4 自定义 Dataset 数据集 25 4.5 总结 27 本章我们的目标是把构建自己的数据集,并来测试和可视化。 4.1 自定义 Variable 数据与网络训练 假如我们并没有图像数据,我们自己创造一些数据,并用它们来分类。 import torch import numpy as np # 生 成 数 据 def dataGenerate ( data , l a b e l ) : 19 20 4.1. 自定义 Variable 数据与网络训练 f o r idata in data : i f idata [ 0 ] < 0 . 5 : # 把 小 于0 .5 的 值 压 缩 到 [ 0 , 1 ] 之 间0 码力 | 29 页 | 1.40 MB | 1 年前3
Lecture Notes on Gaussian Discriminant Analysis, Naiveimage. We assume X = [X1, X2, · · · , Xn]T is a random variable representing the feature vector of the given image, and Y ∈ {0, 1} is a random variable representing if there is a cat in the given image. Now = ψy(1 − ψ)1−y (5) • A2: X | Y = 0 ∼ N(µ0, Σ): The conditional probability of continuous random variable X given Y = 0 is a Gaussian distribution parameterized by µ0 and Σ, such that the corresponding Σ−1(x − µ0) � (6) • A3: X | Y = 1 ∼ N(µ1, Σ): The conditional probability of continuous random variable X given Y = 1 is a Gaussian distribution parameterized by µ1 and Σ, such that the corresponding0 码力 | 19 页 | 238.80 KB | 1 年前3
keras tutorial1) dtype=float32> variable It is used to initializes a variable. Let us perform simple transpose operation in this variable. Keras 23 >>> data = k.variable([[10,20,30,40],[50 [50,60,70,80]]) #variable initialized here >>> result = k.transpose(data) >>> print(result) Tensor("transpose_6:0", shape=(4, 2), dtype=float32) >>> print(k.eval(result)) [[10. 50.] [20. 60.] [30 transpose(data)) [[10 50] [20 60] [30 70] [40 80]] >>> res = k.variable(value=data) >>> print(res)Variable 'Variable_7:0' shape=(2, 4) dtype=float32_ref> is_sparse(tensor) It is used 0 码力 | 98 页 | 1.57 MB | 1 年前3
《TensorFlow 快速入门与实战》3-TensorFlow基础概念解析��/���TensorFlow ������������ • TensorFlow ������� • TensorFlow ������ • ���Tensor���� • ���Variable���� • ���Operation���� • ���Session���� • ����Optimizer���� ���� �� TensorFlow ������� TensorFlow ����� ����� TensorFlow ���� ���� ��� �� Tensor ���� SparseTensor �� ���� Operation ���� Variable ���� Placeholder TensorFlow ������ � TensorFlow ������ ����� TensorFlow ������ ������ TensorFlow placeholder //��� • tf.Variable //�� 16 17 18 13 10 14 11 15 12 7 8 9 4 1 5 2 6 3 “Hello TensorFlow” Try it ���Variable���� TensorFlow �� TensorFlow ���Variable) ���������������� ����������������0 码力 | 50 页 | 25.17 MB | 1 年前3
【PyTorch深度学习-龙龙老师】-测试版202112= tf.placeholder(tf.float32, name='variable_a') b_ph = tf.placeholder(tf.float32, name='variable_b') # 创建输出端子的运算操作,并命名 c_op = tf.add(a_ph, b_ph, name='variable_c') 创建计算图的过程就类比通过符号建立公式? = ? + ?的过程,仅仅是记录了公式的计算步 下载页面,选择 Python 最新版本的下载链接即可下载,下载完成后安 装即可进入安装程序。如图 1.22 所示,勾选”Add Anaconda to my PATH environment variable”一项,这样可以通过命令行方式调用 Anaconda 程序。如图 1.23 所示,安装程序 询问是否连带安装 VS Code 软件,选择 Skip 即可。整个安装流程约持续 5 分钟,具体时间 Layer 基类。创建初始化方法,并调用母类的初始化函数,由 于是全连接层,因此需要设置两个参数:输入特征的长度 inp_dim 和输出特征的长度 outp_dim,并通过 self.add_variable(name, shape)创建 shape 大小,名字为 name 的张量?, 并设置为需要优化。代码如下: 预览版202112 8.4 自定义网络 9 class MyDense(layers0 码力 | 439 页 | 29.91 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 6 - Advanced Learning Techniques - Technical Review6-12 shows multiple examples of pacing functions. The x-axis is the training iteration i.e. the variable described above, and the y-axis is the fraction of data that is enabled from the sorted training recap, refer to the two plots in figure 6-13. Both are plots of functions in a single variable, with the variable on the x-axis and being the y-axis, and we are trying to find the minima for both. On objective function and the one on the right represents a non-convex objective function for a single variable. Typically, the objective function (loss function) of a deep learning model is non-convex. One0 码力 | 31 页 | 4.03 MB | 1 年前3
《Efficient Deep Learning Book》[EDL] Chapter 2 - Compression TechniquesQuantization of sine waves. Let’s dig deeper into its mechanics using an example. Let’s assume we have a variable x which takes a 32-bit floating point value in the range [-10.0, 10.0]. We need to transmit a collection operations which operate on a vector (or a batch) of x variables (vectorized execution) instead of one variable at a time. Although it is possible to work without it, you would have to introduce a for-loop either refers to the batch dimension which is not defined while creating the model. Our batch size could be variable (we could train with a batch size of 16, 32, 64 and so on). The model architecture is independent0 码力 | 33 页 | 1.96 MB | 1 年前3
共 26 条
- 1
- 2
- 3













