Run annealed Langevin dynamics on a batch of points, using the exact score of a Gaussian data distribution smoothed at each noise level.
si(x)=−v+σi2x−μ,αi=ησlast2σi2,x←x+2αisi(x)+αizi,jHere x_init holds the starting points with shape (N, D), sigmas holds L decreasing noise levels in the order they are visited, σi is sigmas[i] for the 0-based level index i, and σlast is the last entry sigmas[L - 1]. The data distribution is a Gaussian with mean μ given by data_mean (shape (D,)) and variance v given by data_var on every axis, so si is the score of that Gaussian after adding noise of level σi. The base step size η is step_size. For each level i from 0 to L - 1, apply the update steps_per_sigma times with inner index j, where the step uses the fresh noise zi,j = noise[i * steps_per_sigma + j], an (N, D) slice of noise, whose shape is (L * steps_per_sigma, N, D). The score is recomputed from the current x at every step.
Return the final points as a NumPy array of shape (N, D) with dtype float64.
Input: x_init = [[0.5,2.0],[-1.0,0.0]], sigmas = [1.0,0.5], steps_per_sigma = 2, step_size = 0.1, noise = [[[0.3,-0.2],[1.0,0.5]],[[-0.4,0.1],[0.2,-0.6]],[[0.0,0.8],[-0.3,0.3]],[[0.5,-0.5],[0.1,0.9]]], data_mean = [1.0,-1.0], data_var = 0.25
Output: [[0.796527,0.749342],[0.33595,-0.15069]]
Explanation: The first noise level uses alpha = 0.1 * 1.0^2 / 0.5^2 = 0.4 with noise rows 0 and 1, and the second level uses alpha = 0.1 with noise rows 2 and 3, so both points drift towards the mean (1, -1) while being perturbed.
Input: x_init = [[4.0],[-2.0],[0.0]], sigmas = [2.0,1.0,0.5], steps_per_sigma = 3, step_size = 0.05, noise = [[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]]], data_mean = [1.0], data_var = 1.0
Output: [[2.885097],[-0.885097],[0.371634]]
Input: x_init = [[1.0,-1.0,0.5]], sigmas = [0.3], steps_per_sigma = 1, step_size = 0.04, noise = [[[0.5,1.0,-1.5]]], data_mean = [0.0,0.0,0.0], data_var = 0.5
Output: [[1.066102,-0.766102,0.183051]]
for i, sigma in enumerate(sigmas) gives each level with its index.
A (D,) mean broadcasts over (N, D) points.
np.array(x_init, dtype=np.float64) makes a float64 copy, so x_init stays unchanged.
Accepts: array
Accepts: array
Accepts: integer
Accepts: number
Accepts: array
Accepts: array
Accepts: number
Run annealed Langevin dynamics on a batch of points, using the exact score of a Gaussian data distribution smoothed at each noise level.
si(x)=−v+σi2x−μ,αi=ησlast2σi2,x←x+2αisi(x)+αizi,jHere x_init holds the starting points with shape (N, D), sigmas holds L decreasing noise levels in the order they are visited, σi is sigmas[i] for the 0-based level index i, and σlast is the last entry sigmas[L - 1]. The data distribution is a Gaussian with mean μ given by data_mean (shape (D,)) and variance v given by data_var on every axis, so si is the score of that Gaussian after adding noise of level σi. The base step size η is step_size. For each level i from 0 to L - 1, apply the update steps_per_sigma times with inner index j, where the step uses the fresh noise zi,j = noise[i * steps_per_sigma + j], an (N, D) slice of noise, whose shape is (L * steps_per_sigma, N, D). The score is recomputed from the current x at every step.
Return the final points as a NumPy array of shape (N, D) with dtype float64.
Input: x_init = [[0.5,2.0],[-1.0,0.0]], sigmas = [1.0,0.5], steps_per_sigma = 2, step_size = 0.1, noise = [[[0.3,-0.2],[1.0,0.5]],[[-0.4,0.1],[0.2,-0.6]],[[0.0,0.8],[-0.3,0.3]],[[0.5,-0.5],[0.1,0.9]]], data_mean = [1.0,-1.0], data_var = 0.25
Output: [[0.796527,0.749342],[0.33595,-0.15069]]
Explanation: The first noise level uses alpha = 0.1 * 1.0^2 / 0.5^2 = 0.4 with noise rows 0 and 1, and the second level uses alpha = 0.1 with noise rows 2 and 3, so both points drift towards the mean (1, -1) while being perturbed.
Input: x_init = [[4.0],[-2.0],[0.0]], sigmas = [2.0,1.0,0.5], steps_per_sigma = 3, step_size = 0.05, noise = [[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]],[[0.0],[0.0],[0.0]]], data_mean = [1.0], data_var = 1.0
Output: [[2.885097],[-0.885097],[0.371634]]
Input: x_init = [[1.0,-1.0,0.5]], sigmas = [0.3], steps_per_sigma = 1, step_size = 0.04, noise = [[[0.5,1.0,-1.5]]], data_mean = [0.0,0.0,0.0], data_var = 0.5
Output: [[1.066102,-0.766102,0.183051]]
for i, sigma in enumerate(sigmas) gives each level with its index.
A (D,) mean broadcasts over (N, D) points.
np.array(x_init, dtype=np.float64) makes a float64 copy, so x_init stays unchanged.
Accepts: array
Accepts: array
Accepts: integer
Accepts: number
Accepts: array
Accepts: array
Accepts: number