pub struct MLPipeline { /* private fields */ }Expand description
ML pipeline for data preprocessing and preparation
Implementations§
Source§impl MLPipeline
 
impl MLPipeline
Sourcepub fn new(config: MLPipelineConfig) -> Self
 
pub fn new(config: MLPipelineConfig) -> Self
Create a new ML pipeline
Sourcepub fn prepare_dataset(&mut self, dataset: &Dataset) -> Result<Dataset>
 
pub fn prepare_dataset(&mut self, dataset: &Dataset) -> Result<Dataset>
Prepare dataset for ML training
Examples found in repository?
examples/real_world_datasets.rs (line 321)
302fn demonstrate_advanced_operations() -> Result<(), Box<dyn std::error::Error>> {
303    println!("🔧 ADVANCED DATASET OPERATIONS");
304    println!("{}", "-".repeat(40));
305
306    let housing = load_california_housing()?;
307
308    // Data preprocessing pipeline
309    println!("Preprocessing pipeline for California Housing:");
310
311    // 1. Train/test split
312    let (mut train, test) = train_test_split(&housing, 0.2, Some(42))?;
313    println!(
314        "  1. Split: {} train, {} test",
315        train.n_samples(),
316        test.n_samples()
317    );
318
319    // 2. Feature scaling
320    let mut pipeline = MLPipeline::default();
321    train = pipeline.prepare_dataset(&train)?;
322    println!("  2. Standardized features");
323
324    // 3. Cross-validation setup
325    let cv_folds = k_fold_split(train.n_samples(), 5, true, Some(42))?;
326    println!("  3. Created {} CV folds", cv_folds.len());
327
328    // Feature correlation analysis (simplified)
329    println!("  4. Feature analysis:");
330    println!("     • {} numerical features", train.n_features());
331    println!("     • Ready for machine learning models");
332
333    // Custom dataset configuration
334    println!("\nCustom dataset loading configuration:");
335    let config = RealWorldConfig {
336        use_cache: true,
337        download_if_missing: false, // Don't download in demo
338        return_preprocessed: true,
339        subset: Some("small".to_string()),
340        random_state: Some(42),
341        ..Default::default()
342    };
343
344    println!("  • Caching: {}", config.use_cache);
345    println!("  • Download missing: {}", config.download_if_missing);
346    println!("  • Preprocessed: {}", config.return_preprocessed);
347    println!("  • Subset: {:?}", config.subset);
348
349    println!();
350    Ok(())
351}Sourcepub fn train_test_split(&self, dataset: &Dataset) -> Result<DataSplit>
 
pub fn train_test_split(&self, dataset: &Dataset) -> Result<DataSplit>
Split dataset into train/test sets
Sourcepub fn cross_validation_split(
    &self,
    dataset: &Dataset,
) -> Result<CrossValidationFolds>
 
pub fn cross_validation_split( &self, dataset: &Dataset, ) -> Result<CrossValidationFolds>
Generate cross-validation folds
Sourcepub fn transform(&self, dataset: &Dataset) -> Result<Dataset>
 
pub fn transform(&self, dataset: &Dataset) -> Result<Dataset>
Transform new data using fitted scalers
Sourcepub fn create_experiment(&self, name: &str, dataset: &Dataset) -> MLExperiment
 
pub fn create_experiment(&self, name: &str, dataset: &Dataset) -> MLExperiment
Create an ML experiment tracker
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MLPipeline
impl RefUnwindSafe for MLPipeline
impl Send for MLPipeline
impl Sync for MLPipeline
impl Unpin for MLPipeline
impl UnwindSafe for MLPipeline
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
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pointable for T
 
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
 
impl<SS, SP> SupersetOf<SS> for SPwhere
    SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
 
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct 
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
 
fn is_in_subset(&self) -> bool
Checks if 
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
 
fn to_subset_unchecked(&self) -> SS
Use with care! Same as 
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
 
fn from_subset(element: &SS) -> SP
The inclusion map: converts 
self to the equivalent element of its superset.