@@ -44,9 +44,6 @@ use std::{
44
44
#[ cfg( any( feature = "nd" ) ) ]
45
45
use ndarray:: { Array1 , Array2 } ;
46
46
47
- #[ cfg( any( feature = "gui" ) ) ]
48
- use eframe:: { egui, epi} ;
49
-
50
47
#[ cfg( any( feature = "csv" ) ) ]
51
48
use {
52
49
polars:: prelude:: { DataFrame , Float32Type } ,
@@ -174,8 +171,6 @@ pub struct SupervisedModel {
174
171
Option < PCA < f32 , DenseMatrix < f32 > > > ,
175
172
Option < SVD < f32 , DenseMatrix < f32 > > > ,
176
173
) ,
177
- #[ cfg( any( feature = "gui" ) ) ]
178
- current_x : Vec < f32 > ,
179
174
}
180
175
181
176
impl SupervisedModel {
@@ -553,27 +548,6 @@ impl SupervisedModel {
553
548
}
554
549
}
555
550
556
- #[ cfg_attr( docsrs, doc( cfg( feature = "gui" ) ) ) ]
557
- #[ cfg( any( feature = "gui" ) ) ]
558
- impl SupervisedModel {
559
- /// Runs an interactive GUI to demonstrate the final model
560
- /// ```no_run
561
- /// # use automl::{SupervisedModel, Settings};
562
- /// let mut model = SupervisedModel::new(
563
- /// smartcore::dataset::diabetes::load_dataset(),
564
- /// Settings::default_regression()
565
- /// # .only(automl::settings::Algorithm::Linear)
566
- /// );
567
- /// model.train();
568
- /// model.run_gui();
569
- /// ```
570
- /// 
571
- pub fn run_gui ( self ) {
572
- let native_options = eframe:: NativeOptions :: default ( ) ;
573
- eframe:: run_native ( Box :: new ( self ) , native_options) ;
574
- }
575
- }
576
-
577
551
/// Private functions go here
578
552
impl SupervisedModel {
579
553
fn build ( x : DenseMatrix < f32 > , y : Vec < f32 > , settings : Settings ) -> Self {
@@ -585,8 +559,6 @@ impl SupervisedModel {
585
559
y_val : vec ! [ ] ,
586
560
number_of_classes : Self :: count_classes ( & y) ,
587
561
comparison : vec ! [ ] ,
588
- #[ cfg( any( feature = "gui" ) ) ]
589
- current_x : vec ! [ 0.0 ; x. shape( ) . 1 ] ,
590
562
preprocessing : ( None , None ) ,
591
563
metamodel : Default :: default ( ) ,
592
564
}
@@ -865,54 +837,6 @@ impl Display for SupervisedModel {
865
837
}
866
838
}
867
839
868
- #[ cfg_attr( docsrs, doc( cfg( feature = "gui" ) ) ) ]
869
- #[ cfg( any( feature = "gui" ) ) ]
870
- impl epi:: App for SupervisedModel {
871
- fn update ( & mut self , ctx : & egui:: CtxRef , _frame : & mut epi:: Frame < ' _ > ) {
872
- egui:: CentralPanel :: default ( ) . show ( ctx, |ui| {
873
- // Add a heading that displays the type of model this is
874
- ui. heading ( format ! ( "{}" , self . comparison[ 0 ] . name) ) ;
875
-
876
- // Add a label that shows the prediction
877
- ui. label ( format ! (
878
- "Prediction: y = {}" ,
879
- self . predict( vec![ self . current_x. to_vec( ) ; 1 ] ) [ 0 ]
880
- ) ) ;
881
-
882
- // Separating the model name and prediction from the input values
883
- ui. separator ( ) ;
884
-
885
- // Step through input values to make sliders
886
- for i in 0 ..self . current_x . len ( ) {
887
- // Figure out the maximum in the training dataa
888
- let maxx = self
889
- . x_train
890
- . get_col_as_vec ( i)
891
- . iter ( )
892
- . cloned ( )
893
- . fold ( 0. / 0. , f32:: max) ;
894
-
895
- // Figure out the minimum in the training data
896
- let minn = self
897
- . x_train
898
- . get_col_as_vec ( i)
899
- . iter ( )
900
- . cloned ( )
901
- . fold ( 0. / 0. , f32:: min) ;
902
-
903
- // Add the slider
904
- ui. add (
905
- egui:: Slider :: new ( & mut self . current_x [ i] , minn..=maxx) . text ( format ! ( "x_{}" , i) ) ,
906
- ) ;
907
- }
908
- } ) ;
909
- }
910
-
911
- fn name ( & self ) -> & str {
912
- "Model Demo"
913
- }
914
- }
915
-
916
840
/// This contains the results of a single model
917
841
#[ derive( serde:: Serialize , serde:: Deserialize ) ]
918
842
struct Model {
0 commit comments