Skip to main content

StatisticalDiffusionBackend

Struct StatisticalDiffusionBackend 

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

A diffusion backend that generates samples matching target statistical properties.

The forward process adds Gaussian noise according to the noise schedule. The reverse process uses Langevin-inspired updates to guide samples toward the target distribution (means, standard deviations, correlations).

Implementations§

Source§

impl StatisticalDiffusionBackend

Source

pub fn new(means: Vec<f64>, stds: Vec<f64>, config: DiffusionConfig) -> Self

Create a new statistical diffusion backend.

§Arguments
  • means - Target means for each feature dimension
  • stds - Target standard deviations for each feature dimension
  • config - Diffusion configuration (steps, schedule type, seed)
Source

pub fn with_correlations(self, corr_matrix: Vec<Vec<f64>>) -> Self

Set the correlation matrix for multi-dimensional generation.

The matrix should be symmetric positive-definite with ones on the diagonal. After denoising, Cholesky decomposition is used to impose this correlation structure on the generated samples.

Trait Implementations§

Source§

impl Clone for StatisticalDiffusionBackend

Source§

fn clone(&self) -> StatisticalDiffusionBackend

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StatisticalDiffusionBackend

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DiffusionBackend for StatisticalDiffusionBackend

Source§

fn forward(&self, x: &[Vec<f64>], t: usize) -> Vec<Vec<f64>>

Forward process: add noise at timestep t.

x_t = sqrt(alpha_bar_t) * x_0 + sqrt(1 - alpha_bar_t) * noise

Source§

fn reverse(&self, x_t: &[Vec<f64>], t: usize) -> Vec<Vec<f64>>

Reverse process: denoise at timestep t using Langevin-inspired updates.

x_{t-1} = x_t - step_size * (x_t - mu) / sigma^2 + noise_scale * noise

Source§

fn generate( &self, n_samples: usize, n_features: usize, seed: u64, ) -> Vec<Vec<f64>>

Generate n_samples with n_features by starting from pure noise and iteratively denoising using the reverse process.

At each reverse step t, the sample is updated via: x_{t-1} = (1 - blend) * x_t + blend * (mu + sigma * z) + noise where blend is derived from the schedule’s signal-to-noise progression, z is standard normal for stochastic variation, and noise decreases to zero at t=0.

Source§

fn name(&self) -> &str

Backend name.

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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