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
impl StatisticalDiffusionBackend
Sourcepub fn new(means: Vec<f64>, stds: Vec<f64>, config: DiffusionConfig) -> Self
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 dimensionstds- Target standard deviations for each feature dimensionconfig- Diffusion configuration (steps, schedule type, seed)
Sourcepub fn with_correlations(self, corr_matrix: Vec<Vec<f64>>) -> Self
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
impl Clone for StatisticalDiffusionBackend
Source§fn clone(&self) -> StatisticalDiffusionBackend
fn clone(&self) -> StatisticalDiffusionBackend
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StatisticalDiffusionBackend
impl Debug for StatisticalDiffusionBackend
Source§impl DiffusionBackend for StatisticalDiffusionBackend
impl DiffusionBackend for StatisticalDiffusionBackend
Source§fn forward(&self, x: &[Vec<f64>], t: usize) -> Vec<Vec<f64>>
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>>
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>>
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.