Skip to main content

AdditiveSurrogate

Struct AdditiveSurrogate 

Source
pub struct AdditiveSurrogate { /* private fields */ }
Expand description

A separable rank-1 Chebyshev energy model c + sum_j g_j(x_j).

Implementations§

Source§

impl AdditiveSurrogate

Source

pub fn fit( x: ArrayView2<'_, f64>, y: ArrayView1<'_, f64>, bounds: Bounds<f64>, degree: usize, ) -> Self

Fit the surrogate to pilot points x (n x d) and values y (n) with a default of 12 backfitting passes.

Source

pub fn fit_backfit( x: ArrayView2<'_, f64>, y: ArrayView1<'_, f64>, bounds: Bounds<f64>, degree: usize, n_passes: usize, ) -> Self

Fit by backfitting (Gauss-Seidel over coordinates).

The intercept is the pilot mean. Each coordinate’s Chebyshev coefficients are refit in turn against the partial residual y - intercept - sum_{l != j} g_l, on a mean-centred design so the fit is consistent under uniform sampling. Sweeping all coordinates n_passes times removes the finite-sample cross-coordinate contamination that an independent per-coordinate fit leaves behind, converging to the joint least-squares additive model while staying O(n_passes d (n degree + degree^3)) – linear in d, unlike the joint solve. Each coordinate’s Gram factor is cached, so a pass costs only one triangular solve per coordinate.

Panics when shapes disagree or degree == 0.

Source

pub fn bounds(&self) -> &Bounds<f64>

Search-space box of the surrogate.

Source

pub fn value(&self, x: ArrayView1<'_, f64>) -> f64

Surrogate value at full point x.

Source

pub fn gradient(&self, x: ArrayView1<'_, f64>) -> Array1<f64>

Analytic gradient of the separable surrogate at x.

Source

pub fn sample<R: Rng + ?Sized>( &self, n: usize, temperature: f64, grid_m: usize, rng: &mut R, ) -> Array2<f64>

Draw n independence proposals from the tempered surrogate density exp(-(f - f_min)/T) by per-coordinate inverse-CDF sampling on an grid_m-point grid. Each coordinate is sampled independently (the separable factorisation), with a uniform within-cell jitter for continuity. Returns an n x d array of points inside the box.

Trait Implementations§

Source§

impl DifferentiableObjective<f64> for AdditiveSurrogate

Source§

fn value_and_gradient(&self, x: ArrayView1<'_, T>) -> (T, Array1<T>)

Returns (f(x), ∇f(x)). Default calls the two methods separately; analytic implementations should override for efficiency.
Source§

impl Gradient<f64> for AdditiveSurrogate

Source§

fn grad(&self, x: ArrayView1<'_, f64>) -> Array1<f64>

Gradient of the underlying scalar field at x.
Source§

fn dim(&self) -> usize

Number of input dimensions (must match the paired Objective::dim).
Source§

impl Objective<f64> for AdditiveSurrogate

Source§

fn eval(&self, x: ArrayView1<'_, f64>) -> f64

Evaluates the objective at a single point.
Source§

fn bounds(&self) -> &Bounds<f64>

The feasible domain (typically a box).
Source§

fn dim(&self) -> usize

Number of input dimensions; matches bounds().dims.
Source§

fn eval_batch(&self, x: ArrayView2<'_, T>) -> Array1<T>

Evaluates a batch of points (rows of x). Read more
Source§

fn global_min(&self) -> Option<&FPair<T>>

Optional known global minimum, used for benchmarking and convergence checks. Default returns None.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V