Skip to content

Commit c983379

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 1b7cf5b + 1be262c commit c983379

File tree

7 files changed

+3
-152
lines changed

7 files changed

+3
-152
lines changed

Cargo.toml

+2-8
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"
@@ -21,7 +21,6 @@ comfy-table = "5.0.0"
2121
humantime = "2.1.0"
2222
ndarray = {version = "0.15.3", optional = true}
2323
polars = {version = "0.17.0", features = ["ndarray"], optional = true}
24-
eframe = {version = "0.15.0", optional = true}
2524
url = {version = "2.2.2", optional = true}
2625
temp-file = {version = "0.1.6", optional = true}
2726
csv-sniffer = { version = "0.1.1", optional = true }
@@ -31,9 +30,4 @@ serde_yaml = "0.8.23"
3130
[features]
3231
default = []
3332
nd = ["ndarray"]
34-
gui = ["eframe"]
35-
csv = ["polars", "nd", "url", "temp-file", "minreq", "csv-sniffer"]
36-
37-
[package.metadata.docs.rs]
38-
all-features = true
39-
rustdoc-args = ["--cfg", "docsrs"]
33+
csv = ["polars", "nd", "url", "temp-file", "minreq", "csv-sniffer"]

README.md

+1-3
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/classification_with_gui.rs

-18
This file was deleted.

examples/regression_with_gui.rs

-20
This file was deleted.

examples/regression_with_gui_and_csv.rs

-26
This file was deleted.

src/lib.rs

-77
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![warn(rustdoc::missing_doc_code_examples)]
44
#![warn(clippy::missing_docs_in_private_items)]
55
#![doc = include_str!("../README.md")]
6-
#![cfg_attr(docsrs, feature(doc_cfg))]
76

87
pub mod settings;
98
pub use settings::Settings;
@@ -44,9 +43,6 @@ use std::{
4443
#[cfg(any(feature = "nd"))]
4544
use ndarray::{Array1, Array2};
4645

47-
#[cfg(any(feature = "gui"))]
48-
use eframe::{egui, epi};
49-
5046
#[cfg(any(feature = "csv"))]
5147
use {
5248
polars::prelude::{DataFrame, Float32Type},
@@ -174,8 +170,6 @@ pub struct SupervisedModel {
174170
Option<PCA<f32, DenseMatrix<f32>>>,
175171
Option<SVD<f32, DenseMatrix<f32>>>,
176172
),
177-
#[cfg(any(feature = "gui"))]
178-
current_x: Vec<f32>,
179173
}
180174

181175
impl SupervisedModel {
@@ -567,27 +561,6 @@ impl SupervisedModel {
567561
}
568562
}
569563

570-
#[cfg_attr(docsrs, doc(cfg(feature = "gui")))]
571-
#[cfg(any(feature = "gui"))]
572-
impl SupervisedModel {
573-
/// Runs an interactive GUI to demonstrate the final model
574-
/// ```no_run
575-
/// # use automl::{SupervisedModel, Settings};
576-
/// let mut model = SupervisedModel::new(
577-
/// smartcore::dataset::diabetes::load_dataset(),
578-
/// Settings::default_regression()
579-
/// # .only(automl::settings::Algorithm::Linear)
580-
/// );
581-
/// model.train();
582-
/// model.run_gui();
583-
/// ```
584-
/// ![Example of interactive gui demo](https://raw.githubusercontent.com/cmccomb/rust-automl/master/assets/gui.png)
585-
pub fn run_gui(self) {
586-
let native_options = eframe::NativeOptions::default();
587-
eframe::run_native(Box::new(self), native_options);
588-
}
589-
}
590-
591564
/// Private functions go here
592565
impl SupervisedModel {
593566
fn build(x: DenseMatrix<f32>, y: Vec<f32>, settings: Settings) -> Self {
@@ -599,8 +572,6 @@ impl SupervisedModel {
599572
y_val: vec![],
600573
number_of_classes: Self::count_classes(&y),
601574
comparison: vec![],
602-
#[cfg(any(feature = "gui"))]
603-
current_x: vec![0.0; x.shape().1],
604575
preprocessing: (None, None),
605576
metamodel: Default::default(),
606577
}
@@ -881,54 +852,6 @@ impl Display for SupervisedModel {
881852
}
882853
}
883854

884-
#[cfg_attr(docsrs, doc(cfg(feature = "gui")))]
885-
#[cfg(any(feature = "gui"))]
886-
impl epi::App for SupervisedModel {
887-
fn update(&mut self, ctx: &egui::CtxRef, _frame: &mut epi::Frame<'_>) {
888-
egui::CentralPanel::default().show(ctx, |ui| {
889-
// Add a heading that displays the type of model this is
890-
ui.heading(format!("{}", self.comparison[0].name));
891-
892-
// Add a label that shows the prediction
893-
ui.label(format!(
894-
"Prediction: y = {}",
895-
self.predict(vec![self.current_x.to_vec(); 1])[0]
896-
));
897-
898-
// Separating the model name and prediction from the input values
899-
ui.separator();
900-
901-
// Step through input values to make sliders
902-
for i in 0..self.current_x.len() {
903-
// Figure out the maximum in the training dataa
904-
let maxx = self
905-
.x_train
906-
.get_col_as_vec(i)
907-
.iter()
908-
.cloned()
909-
.fold(0. / 0., f32::max);
910-
911-
// Figure out the minimum in the training data
912-
let minn = self
913-
.x_train
914-
.get_col_as_vec(i)
915-
.iter()
916-
.cloned()
917-
.fold(0. / 0., f32::min);
918-
919-
// Add the slider
920-
ui.add(
921-
egui::Slider::new(&mut self.current_x[i], minn..=maxx).text(format!("x_{}", i)),
922-
);
923-
}
924-
});
925-
}
926-
927-
fn name(&self) -> &str {
928-
"Model Demo"
929-
}
930-
}
931-
932855
/// This contains the results of a single model
933856
#[derive(serde::Serialize, serde::Deserialize)]
934857
struct Model {

0 commit comments

Comments
 (0)