扰动#
|
甘布尔分布。 |
|
将一个函数转化为具有扰动的可微近似。 |
|
正态分布。 |
甘博尔噪声#
制作扰动函数#
- optax.perturbations.make_perturbed_fun(fun: ~typing.Callable[[TypeAliasForwardRef('chex.ArrayTree')], TypeAliasForwardRef('chex.ArrayTree')], num_samples: int = 1000, sigma: float = 0.1, noise=<optax.perturbations._make_pert.Gumbel object>) Callable[[TypeAliasForwardRef('chex.ArrayTree'), 数组], TypeAliasForwardRef('chex.ArrayTree')][来源]#
将一个函数转化为可微近似,带有扰动。
对于一个函数 \(f\) (
fun), 它创建了一个代理 \(f_\sigma\) 定义为\[f_\sigma(x) = E[f(x +\sigma Z)]\]对于 \(Z\) 噪声采样器中的随机变量样本。这实现了一个蒙特卡洛估计。
- Parameters:
fun – 将要转换为可微分函数的函数。目前支持的签名是从 pytree 到 pytree,其叶子是 jax 数组。
num_samples – 一个整数,用于计算平均的扰动输出数量。
sigma – 一个浮点数,随机扰动的尺度。
noise – 一个分布对象,它必须实现一个样本函数和所需分布的对数概率密度函数,类似于 :class:optax.perturbations.Gumbel。默认是Gumbel分布。
- Returns:
一个具有相同参数签名(加上输入中的额外rng)的函数,可以被自动微分。
参考文献
Berthet 等人, 使用可微分扰动优化器的学习, 2020
另请参见
扰动优化器 示例。