Hitomi's Note
瞳の笔记

李宏毅机器学习 (3)误差和梯度下降

发布于|# AI# DeepLearning

Optimization Fails $$ \Delta L(\theta) \approx 0 $$ local minima local maxima saddle point critical point (gradient = 0) $$ L(\theta)\approx L(\theta')+(\theta-\theta')^Tg+\frac12(\theta-\theta')^TH(\theta-\theta') $$ Gradient 梯度消失 Hessian $$ v^THv>0 \Rightarrow L(\theta)>L(\theta')\Rightarrow\texttt{Local minima} $$ $$ v^THv<0 \Rightarrow L(\theta)<L(\theta')\Rightarrow\texttt{Loca

李宏毅机器学习 (2)回归

发布于|# AI# DeepLearning

PyTorch 操作 训练 model.train() # set to train mode optimizer = torch.optim.SGD(model.parameters(), lr = 1e-5, momentum = 0.9) criterion = torch.nn.MSELoss(reduction = "mean") # set loss function train_pbar = tqdm(train_loader, position = 0, leave = True) for x, y in train_pbar: x, y = x.to('cuda'), y.to('cuda') # move data to GPU pred = model(x) # output predict result

李宏毅机器学习 (1)机器学习介绍

发布于|# AI# DeepLearning

机器学习的本质 机器学习 $\approx$ 寻找(拟合)函数 $f(speech/image) = text$ 机器学习的类型 输入量:向量、矩阵(图像)、序列(语音、文字)。 Regression(回归): outputs a scalar. (输入多类数据,输出一个预测值) Classification(预测): given classes, outputs the correct one.(输入多个类型,输出正确的那个分类) Structured Learning(结构化学习): create something with structure (image, document).(根据输入生成图像) 机器学习的训练过程 Function with unknown parameters (构建具有未知参数的函数) $y = b + wx_1$ (Based on

光耦应用笔记

发布于|# 硬件设计

光耦简介 光耦原理 光耦通常被描述为 Transistor Output Optocouplers Photo-Coupler,在芯片的数据手册中通常会写 PHOTOTRANSISTOR 或者 PHOTOCOUPLER。不难看出光耦和三极管有着一定的联系。 光耦类似于一个 NPN 三极管,具有电流放大作用。正因为这个特性,所以有时候会发生一些反直觉的现象。 光耦通用原理图 其中有几点 很重要,需要仔细确认: R1 电阻为限流电阻,为保护光耦,必须外接 360Ω 左右电阻。经过实际测试,300Ω、330Ω、360Ω、470Ω、510Ω 均可以正常工作。 R2 电阻为上拉电阻,也有说法是可以使光耦快速且稳定地进入饱和状态。电阻可以在 1KΩ 左右。经过实际测试,360Ω、1KΩ、4.7KΩ 均可以正常工作。这一项必须根据不同的光耦进行修改。 可以不共电源域,包括 VCC 和 GND 均可

IDA Pro 7.6 SP1 Python 及 Lumina 配置

发布于|# CTF

下载与安装 根据网上泄露的资源,这里下载到的是 IDA Pro 7.6.210427 SP1 x64 + Hexrays, Hexarm & Hexmips Decompilers.7z。 压缩包内有两个文件夹,一个是 Other,另一个是 Software。将 Software 中的内容全部解压出来,IDA 的本体就可以使用了。 Python 配置 修改 IDA 文件 IDA 默认不支持 Python 3.9 版本。在压缩包的 Others 文件夹下有一个 ida76sp1_python39_win 目录。将其中的内容拖动到根目录,会有文件覆盖提示,依次覆盖即可。 下载 Python 本体 不建议使用系统 Python,容易引起环境之间的干扰。而且系统 Python 占用空间非常大,排起错来非常麻烦。 压缩包内并没有放置 Python 的文件,所以需要自行到官网下载。下载时选择

CTF 中绕过 MD5 的特殊字符串

发布于|# CTF# Web

MD5 后以 0e 开头 QNKCDZO s1091221200a s878926199a s214587387a s155964671a 更多参见此处。 二次 MD5 后以 0e 开头 7r4lGXCH2Ksu2JNT3BYM CbDLytmyGm2xQyaLNhWn 770hQgrBOjrcqftrlaZk MD5 后以 ‘or’ 开头 ffifdyop 129581926211651571912466741651878684928

CTF 中的密码学 之 数论

发布于|# CTF# Crypto

模逆 定义 对于一个数 $a$,他在模 $n$ 域下存在一个数 $b$,使得 $(a\times b)\mod n=1$,则称 $b$ 为 $a$ 在模 $n$ 域下的模逆元,即 $a^{-1}=b$ 条件 $a$ 与 $n$ 必须互质,即最大公约数为 $1$。 求法(python) b = gmpy2.invert(a, n) 模运算法则 $(a + b) \mod p = (a \mod p + b \mod p) \mod p$ $(a \times b) \mod p = (a \mod p \times b \mod p) \mod p$ $(a - b) \mod p = (a \mod p - b \mod p ) \mod p$ $((a +b)\mod p \times c) \mod p = ((a \times c) \mod p +

Codeforces Round 740

发布于|# ACM# CodeForces

#include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int dp[n + 1]; int suff[n + 2]; dp[n] = 1; suff[n] = 1; suff[n + 1] = 0; for (int i = n - 1; i >= 1; i--) { dp[i] = suff[i + 1]; for (int b = 2; b <= n / i; b++) { dp[i] += suff[b * i] - suff[min(n + 1, b * i + b)]; while (dp[i] < 0) dp[i] += m;

Aegisub 简明教程

发布于|# 软件

格式控制符 控制符 作用 \n 只有在 \q2 环境下才表现为 \N ,否则表现为普通空格 \N 换行 \h 非换行空白(NBSP),用于人名等整体 \q <style> 用于设置文字自动换行。 style 作用 0 使每一行尽可能一样长,如果不能,则使首行最长。\n 将表现为普通空格。 1 向一行内放置尽可能多的文字,如果放不下则换行。\n 将表现为普通空格。 2 禁用自动换行,行有可能超出屏幕范围。\n 将表现为 \N。 3 使每一行尽可能一样长,如果不能,则使尾行最长。\n 将表现为普通空格。 字体控制符 斜体 控制符 作用 \i1 启用 \i0 禁用 粗体 控制符 作用 \b1 启用 \b0 禁用 \b <weight> 设置字重。400 常规,

Codeforces Round 736 (Div. 2 & 1) [CF-1549 & CF-1548]

发布于|# ACM# CodeForces

A - Gregor and Cryptography Gregor is learning about RSA cryptography, and although he doesn't understand how RSA works, he is now fascinated with prime numbers and factoring them. Gregor's favorite prime number is $P$. Gregor wants to find two bases of $P$. Formally, Gregor is looking for two integers $a$ and $b$ which satisfy both of the following properties. $P\mod a=P\mod b$, where $x\mod y$