All Tags
Autograd 源码学习系列总览 用过自动微分之后,很自然会想知道:输入仍然是一段普通 Python 程序,梯度究竟是在什么时刻、由哪些对象算出来的?这个系列沿 HIPS/autograd 的实际调用链,把数学里的链式法则接到 Box、primitive、局部 VJP 和运行时状态上。 Autograd 源码学习(一):自动微分与计算图 会用链式法则,并不意味着已经知道一段 Python 程序如何得到梯度。计算图把这个过程拆成了可以逐步检查的局部操作:先算出值,再沿依赖反向传回贡献。 Autograd 源码学习(二):JVP、VJP 与两种自动微分模式 上一篇把导数沿计算图传播的过程拆开了。面对向量输入和向量输出,接下来的问题是:我们究竟要得到整个 Jacobian,还是只需要知道它对某个方向的作用? Autograd 源码学习(三):从 grad 开始追踪完整调用链 现在已经知道 grad 最终要做一次 VJP 查询,但 grad(f)(3.0) 中还夹着参数适配、装箱、primitive 调用和图节点创建。只看最后两行反向代码,很容易漏掉这些对象是从哪里来的。 Autograd 源码学习(四):tracer.py 与动态计算图 上一篇已经走完 grad 的调用链,这里把镜头停在 primitive 收到 Box 的时刻。一个普通数值调用,要增加哪些状态,才能让后面的求导继续知道依赖来自哪里? Autograd 源码学习(五):Reverse Mode 的核心实现 上一篇已经看到 primitive 如何产生 VJPNode。这里从 forward 留下的 end node 开始,检查局部规则怎样接到输出 seed,又怎样把贡献交给同一个输入。 Autograd 源码学习(六):NumPy Primitive 与 VJP 通用 reverse engine 已经知道怎样调用 node.vjp(g) ,但它并不知道 sin、exp 或乘法的导数。数学语义来自 NumPy 集成中为每个 primitive 登记的局部规则。 Autograd 源码学习(七):Broadcasting 的反向传播 上一篇的 binary VJP 总会出现 unbroadcast_f 。即使局部导数的每个数字都算对了,若返回的 shape 不属于原输入空间,整个规则仍然是错的。 Autograd 源码学习(八):Forward Mode 与 JVPNode 到这里,reverse mode 的保存、等待和反向遍历已经完整了。换成 forward mode 后,tracer 仍然可用,但一个 operation 在创建节点时就已经拿到了所有 parent tangents。 Autograd 源码学习(九):为什么机器学习偏爱 Reverse Mode 两种模式都能正确使用链式法则,差别在一次查询能得到多少导数信息。机器学习常见的输入是大量参数,输出却只有一个 loss,这个维度关系决定了 reverse mode 的优势。 Autograd 源码学习(十):高阶自动微分与 Nested Tracing 求完一阶导数后,Autograd 执行过的是一段由 VJP operations 组成的程序。若这段程序本身还能被追踪,就可以继续对它求导。 Autograd 源码学习(十一):Jacobian、Hessian 与算子组合 有了 JVP、VJP 和 nested tracing,再看 jacobian、hessian、make_hvp,就不需要假设它们各自隐藏着一套求导引擎。它们主要改变查询方向、组织结果,或对导数程序再次求导。 Autograd 源码学习(十二):Numerical Gradient Checking 源码中的局部规则写得简洁,并不能替代独立验证。有限差分只使用函数值,为 AD 的方向、符号和 shape 提供了另一条检查路线。 Autograd 源码学习(十三):自定义 Primitive 如果一个计算已经被声明为 primitive,Autograd 就把它当作原子调用。原函数能算出值,并不意味着框架已经知道如何把 cotangent 拉回输入。 Autograd 源码学习(十四):Mini Autograd:实现与源码对读 最后回到一个可以完整掌握的标量引擎。教材已有的 Mini Autograd 把值、父引用和梯度放在 Value 中,正好可以与 HIPS 中分开的 Box、VJPNode 和 outgrads 对照。 人工智能博士资格考试复习资料 覆盖机器学习理论、深度学习与强化学习、人工智能中的优化方法和自然语言处理,可用于系统复习、证明训练与历年真题准备。 计算与应用数学博士资格考试复习资料 覆盖误差分析、逼近论、非线性问题、线性代数、常微分方程、偏微分方程、渐近分析与优化,可用于系统复习与历年真题准备。 概率论与数理统计博士资格考试复习资料 覆盖概率论基础与极限定理、随机过程和数理统计,可用于系统复习、证明训练与历年真题准备。 密码分析学概述 Kerckhoffs 准则 :密码体制的安全性仅依赖于密钥,其他一切包括算法本身都是公开的。 Markov Chains A sequence of random variables \(\left\{X_n\right\}\) is a Markov process with state space \(S\) and transition probabilities \(P\) if for all \(n\ge 0\) and all sequences \(x_0,\ldots,x_n,x_{n+1}\in S\) , we have that Conditional Expectation Theorem Let \(X\in L^1(\Omega,\mathcal{F},\mathbb{P})\) and let \(\mathcal{A}\subset\mathcal{F}\) be a sub- \(\sigma\) -field. Then there exists a unique random variable \(Y\) such that: 计算与应用数学 暂无预览 PDE 数值解大作业 暂无预览 ICBS 2024 课程报告 暂无预览 数学史论文 暂无预览 Law of Large Numbers Let \((X_n)_{n\ge 1}\) be i.i.d. random variables with finite mean \(m\) , and set Central Limit Theorem For a real random variable \(X\) with law \(\mu\) , its characteristic function is GTM295 Chapter 8 Exercise 8.1 Consider a population of \(n\) individuals and \(r \in \{1,\ldots,n-1\}\) . GTM295 Chapter 9 Exercise 9.1 GTM295 Chapter 10 Exercise 10.1 In this exercise, to emphasize the dependence on the underlying probability measure, we speak of convergence in \(\mathbb{P}\) -probability instead of convergence in probability.... GTM295 Chapter 11 Exercise 11.1 (Bayes Formula) GTM295 Chapter 12 Exercise 12.1 Let \((X_n)_{n\in\mathbb{N}}\) be a sequence of independent real random variables. Set \(S_0=0\) and \(S_n=X_1+\cdots+X_n\) for every \(n\in\mathbb{N}\) , and consider the canonical filtration \((\mathcal{F}_n)_{n\in\mathbb{Z}_+}\) of the process \((S_n)_{n\in\mathbb{Z}_+}\) . Prove that: GTM295 Chapter 13 Exercise 13.1 Let \(E\) and \(F\) be two countable sets and let \(f:E\to F\) be a surjective map. Let \((X_n)_{n\in\mathbb{Z}_+}\) be a Markov chain on \(E\) with transition matrix \(Q\) . Assume that, for every \(a\in F\) , and every \(x,x'\in E\)... GTM295 Chapter 14 In Exercises 14.1 to 14.11, \((B_t)_{t\ge0}\) is a one-dimensional Brownian motion with \(B_0=0\) , and \(S_t=\sup\{B_s:0\le s\le t\}\) . Probability Space and Random Variables A probability space is a triplet \((\Omega, \mathcal{F}, \mathbb{P})\) consisting of: Convergences 参考书:吴昊老师的讲义 Principles of Data Reduction A sufficient statistic for a parameter \(\theta\) is a statistic that, in a certain sense, captures all the information about \(\theta\) contained in the sample. Any additional information in the... Point Estimation A point estimator is any function \(W(X_1, \cdots, X_n)\) of a sample; that is, any statistic is a point estimator. Hypothesis Testing A hypothesis is a statement about a population parameter. Probability Theory 样本空间(sample space) The set \(S\) of all possible outcomes of a particular experiment is called the sample space. Transformation and expectation Transformation Let \(X\) be a random variable with cdf \(F_X(x)\) and pdf (or pmf) \(f_X(x)\) . Let \(Y = g(X)\) , where \(g\) is a one-to-one function, mapping the original sample space of \(X\) , \(\mathcal{X}\) , to a new sam... Common Families of Distributions discrete uniform (1,N) distribution Multiple Random Variables An \(n\) -dimensional random vector is a function from a sample space \(S\) into \(\mathbb{R}^n\) , \(n\) -dimensional Euclidean space. Properties of a Random Sample The random variables \(X_1,\cdots,X_n\) are called a random sample of size \(n\) from the population \(f(x)\) if \(X_1,\cdots,X_n\) are mutually independent and the marginal pdf or pmf of each \(X_i\) is \(f(x)\) . Alternatively, \(X_1,\cdots,X_n\)... 数分 参考书:梅加强 电动力学期末cheatsheet 暂无预览 俄语 1 笔记 :---: :---: :---: :---: :---: :---: :---: Аа Бб Вв Гг Дд Ее Ёё Жж Зз Ии Йй Кк Лл Мм Нн Оо Пп Рр Сс Тт Уу Фф Хх Цц Чч Шш Щщ ъ ы ь Ээ Юю Яя 周期积分方程 Consider heat/electrical problem. A single inclusion \(\Omega\) per unit cell. \(e_1\) and \(e_2\) are the basis of the lattice on \(\mathbb{R}^2\) . We working with unit square \(e_1 = (1,0)\) and \(e_2 = (0,1)\) for simplicity. Let 量子力学 一个复向量空间 \(V\) 称为 内积空间 ,如果其上定义了一个映射 \(\langle \cdot, \cdot \rangle : V \times V \rightarrow \mathbb{C}\) ,满足: 电动力学期中cheatsheet 暂无预览 Deep Learning Crash Course Transformer 的本质是摒弃了 RNN 的时序递归,用极其暴力的全局矩阵乘法来实现特征交互。 假设输入序列为 \(X \in \mathbb{R}^{n \times d}\)\(n\) 是序列长度, \(d\) 是词向量维度)。首先,输入 \(X\) 会乘上三个不同的权重矩阵 \(W^Q, W^K \in \mathbb{R}^{d \times d_k}\)\(W^V \in \mathbb{R}^{d \times d_v}\) ,将特征映射到不同的子空间: Machine Learning Crash Course --- 在监督学习中,我们有一个输入空间 \(\mathcal{X}\) (比如图片的像素特征)和一个标签空间 \(\mathcal{Y}\) (比如分类类别)。 Optimization Methods Crash Course 如果函数 \(f(x)\)\(L\) -smoothness 的,意味着它的梯度是 \(L\) -Lipschitz 连续的。对于定义域内的任意 \(x, y\) ,满足: \[||\nabla f(x) - \nabla f(y)|| \le L ||x - y||\] 等价的二阶泰勒展开上限形式: Asymptotic Analysis Exercises \[u^{\prime\prime}+(\lambda+\epsilon f(x))u=0, \quad 0<x<1\] Convex Optimization Exercises \[\max_{x}\langle c,x\rangle \quad \text{s.t.} \quad Ax=b, \quad x\ge0\] Numerical Algebra Exercises 1: find an upper Hessenberg matrix \(H_{0}\) and a unitary matrix \(U_{0}\) such that \(H_{0}=U_{0}^{H}AU_{0}\) . Numerical Ode Exercises \[\begin{array}{c|cc} 0 & 0 & \\ 1 & 1 & 0 \\ \hline & 1/2 & 1/2 \end{array}\] Numerical Pde Exercises \[u_{m}^{n+1}=\frac{1}{2}(u_{m+1}^{n}+u_{m-1}^{n})-\frac{1}{2}akh^{-3}(u_{m+2}^{n}-2u_{m+1}^{n}+2u_{m-1}^{n}-u_{m-2}^{n}),\] Approximation Interpolation Exercises Consider the Newton's method for finding a solution \(x_{*}\) to \(f(x)=0\) , where \(f\in C^{2}(a,b)\) , \(x_{*}\in(a,b)\) . 练习题集 函数逼近与插值练习题 Numerical Integration Exercises --- Assume that \(f\) is a periodic function with period \(2\pi\) . Considering the integration \(I(f)=\int_{0}^{2\pi}f(x)dx\) , prove the following statements on the order of convergence of composite trapezoidal rule... 统计力学复习笔记 微正则系综 (Microcanonical Ensemble, E.V.N) 系统孤立,能量 \(E\) 、体积 \(V\) 、粒子数 \(N\) 固定。 玻尔兹曼熵公式 : 大作业 暂无预览 大作业 暂无预览 习题 2 试引入适当的无量纲的空间和时间变量,将一维有限区域上均匀介质中无源热流运动在齐次 Dirichlet 边界条件下的初边值问题化为定义在 \((0,1) \times \mathbb{R}_+\) 上的标准形式的模型问题 \((2.2.1) \sim (2.2.3)\) 习题 1 \(\Omega\) 是一个 \(\mathbb{R}^n\) 中具有 Lipschitz 连续边界的有界开集, \(\partial \Omega_D\) 对应 Dirichlet 边界。在 \(\Omega\) 上定义网格,若最大步长 \(h_{max}\) 与最小步长 \(h_{min}\) 满足 \(\frac{h_{max}}{h_{min}}\le C\) ,则称该网格为拟一致网格。特别的若网格为均匀网格,则称该网格为一致网格。 Numerical Linear Algebra Metric (度量) \(d(x, y)\) : 定义集合上的距离。映射 \(d: X \times X \to \mathbb{R}_{\ge 0}\) 满足: \(d(x, y) \ge 0\)\(d(x, y) = 0 \iff x = y\) (非负性 & 唯一性) \(d(x, y) = d(y, x)\) (对称性) \(d(x, z) \le d(x, y) + d(y, z)\) (三角不等式) 第四章:有限元理论与有限元方法 1950s, 美国与德国 :航空工程与机械工程领域。代表人物:Plantl 和 Coniant。 1950s, 苏联 :基础数学与 Sobolev 空间。代表人物:Sobolev。 1965, 中国 :基于变分原理的差分格式。代表人物:冯康(Kang Feng)。 他的十六字方针: 分整为零、裁弯取直、以简驭繁、化难为易 。 Notes \[\mathbb{P}(X\geqslant t)\leqslant \frac{\mathbb{E} X}{t}\] 凸分析 我们只考虑 \(\mathbb{R}^n\) 空间上的优化问题。 所有的向量约定为列向量。 \('\) 表示转置。 \(x'y\)\(\sum_{i=1}^{n}\) 表示 \(x\)\(y\) 的内积。 \(||x||_2 = (x'x)^{1/2}\)\(x\) 的欧几里得范数。 凸多面体 一个 超平面(hyperplane) 是形如 \[H=\left\{ x\Big| a'x=b\right\}\] 的集合,其中 \(a\in \mathbb{R}^n,b\in \mathbb{R}\)\(a\neq 0\) 凸优化 对任意 \(f:\mathbb{R}^n\rightarrow [-\infty,+\infty]\) ,其 共轭凸函数(conjugate convex function) 定义为 \[f^*(y)=\sup_{x\in \mathbb{R}^n} (x'y -f(x)), \forall y\in \mathbb{R}^n.\] 几何对偶框架 \(M\)\(\mathbb{R}^{n+1}\) 的非空子集。 最小公共点问题(minimum common point problem) :寻找点 \((x,w)\in M\) 使得 \(w\) 最小化。 凸优化课程作业 暂无预览 第三章:双曲型方程的有限差分法 线性双曲型偏微分方程:输运方程、波动方程、特征线。 线性混合方程:对流扩散方程、拟线性双曲型方程。 双曲守恒律:通量、总变差减小、激波、Godunov 方法、ENO / WENO 格式、黎曼求解器。 第二章:抛物型方程的有限差分法 我们考虑带有初值和 Dirichlet 边界条件的一维热方程: Chapter1 首先我们给出推广的定义。考虑高维 PDE Chapter0 我们考虑一般形式的二阶PDE: 代数2-H笔记 暂无预览 交换代数 暂无预览 表示论 暂无预览 分析2-H笔记 暂无预览 微分几何 暂无预览 实分析 暂无预览 中级微观经济学 暂无预览 附录:算法说明 暂无预览 恩尼格玛密码机的破解 暂无预览 分组密码的差分分析及相关分析方法 暂无预览 分组密码的线性分析及相关分析方法 暂无预览 积分分析 暂无预览 中间相遇攻击 暂无预览 分组密码的其他攻击方法 暂无预览 分组密码各种分析方法的等价性 暂无预览 区分器的自动化搜索 暂无预览 分组密码工作模式的攻击概述 暂无预览 序列密码的经典安全性分析技术 暂无预览 序列密码的立方攻击 暂无预览 杂凑函数的安全性分析概述 暂无预览 消息认证码的安全性分析概述 暂无预览 侧信道分析概述 暂无预览