pub struct TrainedDiffusionModel {
pub column_params: Vec<ColumnDiffusionParams>,
pub correlation_matrix: Vec<Vec<f64>>,
pub config: DiffusionConfig,
pub metadata: ModelMetadata,
}Expand description
A trained diffusion model that can generate samples and be persisted to disk.
Fields§
§column_params: Vec<ColumnDiffusionParams>Per-column statistical parameters.
correlation_matrix: Vec<Vec<f64>>Correlation matrix (n_columns x n_columns).
config: DiffusionConfigDiffusion configuration used during training.
metadata: ModelMetadataModel metadata.
Implementations§
Source§impl TrainedDiffusionModel
impl TrainedDiffusionModel
Sourcepub fn generate(&self, n_samples: usize, seed: u64) -> Vec<Vec<f64>>
pub fn generate(&self, n_samples: usize, seed: u64) -> Vec<Vec<f64>>
Generate n_samples rows of synthetic data using the trained model parameters.
Each row contains one value per column. Column types are respected:
- Continuous: clipped to
[min, max] - Integer: rounded and clipped to
[min, max] - Categorical: mapped to category indices, rounded and clipped to
[0, n_categories - 1]
Sourcepub fn save(&self, path: &Path) -> Result<(), SynthError>
pub fn save(&self, path: &Path) -> Result<(), SynthError>
Serialize and save the model to a JSON file at path.
Sourcepub fn load(path: &Path) -> Result<Self, SynthError>
pub fn load(path: &Path) -> Result<Self, SynthError>
Load a model from a JSON file at path.
Trait Implementations§
Source§impl Clone for TrainedDiffusionModel
impl Clone for TrainedDiffusionModel
Source§fn clone(&self) -> TrainedDiffusionModel
fn clone(&self) -> TrainedDiffusionModel
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TrainedDiffusionModel
impl Debug for TrainedDiffusionModel
Source§impl<'de> Deserialize<'de> for TrainedDiffusionModel
impl<'de> Deserialize<'de> for TrainedDiffusionModel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TrainedDiffusionModel
impl RefUnwindSafe for TrainedDiffusionModel
impl Send for TrainedDiffusionModel
impl Sync for TrainedDiffusionModel
impl Unpin for TrainedDiffusionModel
impl UnwindSafe for TrainedDiffusionModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more