Skip to content

Commit 8b60d64

Browse files
committed
Cleanup and small fixes
1 parent 1a574c1 commit 8b60d64

File tree

6 files changed

+2
-126
lines changed

6 files changed

+2
-126
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "automl"
3-
version = "0.2.5"
3+
version = "0.2.6"
44
authors = ["Chris McComb <[email protected]>"]
55
description = "Automated machine learning for classification and regression"
66
edition = "2021"

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and provides some utilities to quickly train and compare models.
1010
# Install
1111
To use the latest released version of `AutoML`, add this to your `Cargo.toml`:
1212
```toml
13-
automl = "0.2.5"
13+
automl = "0.2.6"
1414
```
1515
To use the bleeding edge instead, add this:
1616
```toml
@@ -54,8 +54,6 @@ This crate has several features that add some additional methods
5454
|:----------|:----------------------------------------------------------------------------------------------------------|
5555
| `nd` | Adds methods for predicting/reading data using [`ndarray`](https://crates.io/crates/ndarray). |
5656
| `csv` | Adds methods for predicting/reading data from a .csv using [`polars`](https://crates.io/crates/polars). |
57-
| `gui` | Adds a method for running a live demo GUI of a model through [`eframe`](https://crates.io/crates/eframe). |
58-
5957

6058
## Capabilities
6159
- Feature Engineering

assets/gui.png

-88 KB
Binary file not shown.

examples/regression_with_gui.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/regression_with_gui_and_csv.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/lib.rs

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ use std::{
4444
#[cfg(any(feature = "nd"))]
4545
use ndarray::{Array1, Array2};
4646

47-
#[cfg(any(feature = "gui"))]
48-
use eframe::{egui, epi};
49-
5047
#[cfg(any(feature = "csv"))]
5148
use {
5249
polars::prelude::{DataFrame, Float32Type},
@@ -174,8 +171,6 @@ pub struct SupervisedModel {
174171
Option<PCA<f32, DenseMatrix<f32>>>,
175172
Option<SVD<f32, DenseMatrix<f32>>>,
176173
),
177-
#[cfg(any(feature = "gui"))]
178-
current_x: Vec<f32>,
179174
}
180175

181176
impl SupervisedModel {
@@ -553,27 +548,6 @@ impl SupervisedModel {
553548
}
554549
}
555550

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-
/// ![Example of interactive gui demo](https://raw.githubusercontent.com/cmccomb/rust-automl/master/assets/gui.png)
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-
577551
/// Private functions go here
578552
impl SupervisedModel {
579553
fn build(x: DenseMatrix<f32>, y: Vec<f32>, settings: Settings) -> Self {
@@ -585,8 +559,6 @@ impl SupervisedModel {
585559
y_val: vec![],
586560
number_of_classes: Self::count_classes(&y),
587561
comparison: vec![],
588-
#[cfg(any(feature = "gui"))]
589-
current_x: vec![0.0; x.shape().1],
590562
preprocessing: (None, None),
591563
metamodel: Default::default(),
592564
}
@@ -865,54 +837,6 @@ impl Display for SupervisedModel {
865837
}
866838
}
867839

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-
916840
/// This contains the results of a single model
917841
#[derive(serde::Serialize, serde::Deserialize)]
918842
struct Model {

0 commit comments

Comments
 (0)