import MCMC from './_mcmc'; import { Normal } from '../dist'; /** * Class implementing the [Metropolis-adjusted Langevin algorithm]{@link https://en.wikipedia.org/wiki/Metropolis-adjusted_Langevin_algorithm} * (MALA) sampler. Proposes a single gradient-informed Langevin step per iteration * (`x' = x + (stepSize^2 / 2) * gradLogDensity(x) + stepSize * z`, `z ~ N(0, I)`), then * applies a Metropolis-Hastings correction for the proposal's asymmetry (the transition * density's mean is state-dependent, so `q(x'|x) != q(x|x')`) to make the chain exact. * During warm-up, the step size is adapted via batch Robbins-Monro (Roberts & Rosenthal * 2009), the same scheme `RWM` uses, toward the MALA-optimal acceptance rate of ~0.574 * (Roberts & Rosenthal 1998). * * @class MALA * @memberof ran.mc * @param {Object} options MALA options, as a single object. * @param {Function} options.logDensity The logarithm of the (unnormalized) target density. * @param {Function} options.gradLogDensity The gradient of logDensity: maps a state (number[]) to * its gradient (number[]) of the same dimension. * @param {Object=} options.config MALA configuration (see MCMC base class for shared options), * plus `stepSize` (ε, default 0.1). * @param {Object=} options.initialState Initial state of the sampler (see MCMC base class). * @constructor * @throws {Error} If options is not a plain object, or gradLogDensity is not a function, or a * stepSize (config.stepSize or a resumed initialState.internal.stepSize) is provided but is not a * positive finite number. */ export default class MALA extends MCMC { _gradLnp: Function; _ls: any; _q: Normal; _pAccepted: any; _pN: any; _pBatch: any; /** * @param {Object} options MALA options, as a single object. * @param {Function} options.logDensity The logarithm of the (unnormalized) target density. * @param {Function} options.gradLogDensity The gradient of logDensity: maps a state (number[]) * to its gradient (number[]) of the same dimension. * @param {Object=} options.config MALA configuration (see MCMC base class for shared options), * plus `stepSize` (ε, default 0.1). * @param {Object=} options.initialState Initial state of the sampler (see MCMC base class). */ constructor(options: { logDensity: Function; gradLogDensity: Function; config?: any | undefined; initialState?: any | undefined; }); /** * Sets the seed for the sampler's pseudo random number generator, including the internal * proposal noise distribution's generator. * * @method seed * @memberof ran.mc.MALA * @param {number|string} value The value of the seed, either a number or a string (for the ease of tracking seeds). * @returns {this} Reference to the current sampler. * @ignore */ seed(value: number | string): this; _iter(x: any): { x: any; accepted: boolean; }; _adjust(i: any): void; _internal(): { stepSize: number; ls: any; prngQ: number[]; pAccepted: any; pN: any; pBatch: any; }; static _validateOptions(options: any): void; static _isPlainObject(options: any): boolean; static _validateGradLogDensity(gradLogDensity: any): void; static _validateStepSize(stepSize: any): void; static _sqDist(a: any, b: any): any; }