随笔分类 - 一些有趣的问题
摘要:times = 1000 changeList = [] noChangeList = [] for i in range(times): #车真实位置 carIndex = random.randint(1,3) #玩家选择 choiceIndex = random.randint(1,3) #主
阅读全文
摘要:1,数据生成 import random import numpy as np from matplotlib import pyplot as plt aList = [] num1 = 0 bList = [] num2 = 0 for i in range(1000): point = [ra
阅读全文
摘要:在epoch超过阈值的前提下,$lrlossCoeffepoch$的值也超过一定的阈值,才能使得训练结束后模型收敛。 from tqdm import tqdm data1 = torch.nn.Parameter(torch.randn(3, 2048)) data2 = torch.ones(3
阅读全文
摘要:1,思路 根据定义 \[ \frac{dy}{dx}=\lim_{\Delta{x\to{0}}}\frac{\Delta{y}}{\Delta{x}} \] 而为了使得上式在计算机中可计算,就体现出了泰勒展开的重要性 使用pytorch的自动求导功能(结合nn.Parameter以及backwar
阅读全文
摘要:计算公式 p范数(p-norm):p的取值范围是[1.inf),p在范围(0,1)内并不是范数,因为违反三角不等式(||x+y||≤||x||+||y||) \[ ||x||_{p}=(\sum_{i=1}^{n}|x_{i}|^{p})^{\frac{1}{p}} \] 单位球 范数≤1的所有向量
阅读全文
摘要:1,推导 一个样本在一次抽样过程中未被抽中的概率为 \[ (1- \frac{1}{n}) \tag{1} \] n次抽样均为被抽中的概率为 \[ (1-\frac{1}{n})^n \tag{2} \] 当n趋向于无穷大时的概率为 \[ \lim_{n \to \infty} (1-\frac{1
阅读全文
摘要:1,工程上的做法有:同时运行n个这样的伪随机数程序,每步产生n个随机数,那么这n个数的和就近似服从正态分布了。 from matplotlib import pyplot as plt import random from tqdm import tqdm n = 20000 result = []
阅读全文