@@ -580,18 +580,14 @@ where
580
580
/// # Example
581
581
/// ```
582
582
/// let dataset = linfa_datasets::iris();
583
-
584
583
/// println!("First 5 rows {:?}", dataset.records.slice(s![0..5,..]));
585
584
/// let feature_names = dataset.feature_names();
586
585
/// let target_names = dataset.target_names();
587
-
588
586
/// let mut rng = thread_rng();
589
587
/// let shuffled = dataset.shuffle(&mut rng);
590
-
591
588
/// println!("First 5 rows after shuffling {:?}", shuffled.records.slice(s![0..5,..]));
592
589
/// assert_eq!(feature_names, shuffled.feature_names());
593
- /// /// assert_eq!(target_names, shuffled.target_names());
594
- ///
590
+ /// assert_eq!(target_names, shuffled.target_names());
595
591
/// ```
596
592
pub fn shuffle < R : Rng > ( & self , rng : & mut R ) -> DatasetBase < Array2 < F > , T :: Owned > {
597
593
let mut indices = ( 0 ..self . nsamples ( ) ) . collect :: < Vec < _ > > ( ) ;
@@ -601,7 +597,9 @@ where
601
597
let targets = self . as_targets ( ) . select ( Axis ( 0 ) , & indices) ;
602
598
let targets = T :: new_targets ( targets) ;
603
599
604
- DatasetBase :: new ( records, targets) . with_feature_names ( self . feature_names ( ) . to_vec ( ) ) . with_target_names ( self . target_names ( ) . to_vec ( ) )
600
+ DatasetBase :: new ( records, targets)
601
+ . with_feature_names ( self . feature_names ( ) . to_vec ( ) )
602
+ . with_target_names ( self . target_names ( ) . to_vec ( ) )
605
603
}
606
604
607
605
#[ allow( clippy:: type_complexity) ]
0 commit comments