From cd47bd7d12b1e8827833dc59f682244b07c282ff Mon Sep 17 00:00:00 2001 From: lluni Date: Sun, 15 Jan 2023 23:39:02 +0100 Subject: [PATCH] Removed sorting the training set for plotting as it isn't needed (anymore) --- examples/example_sine.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/example_sine.rs b/examples/example_sine.rs index 7ab0e1a..45da5b8 100644 --- a/examples/example_sine.rs +++ b/examples/example_sine.rs @@ -79,20 +79,18 @@ fn main() -> Result<(), Box> { .draw()?; // add the first plot - let mut data1: Vec<(f64,f64)> = x_test.iter().zip(y_test_true.iter()) + let data1: Vec<(f64,f64)> = x_test.iter().zip(y_test_true.iter()) .map(|(x, y)| (x[0], y[0])) .collect(); - data1.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap()); chart .draw_series(LineSeries::new(data1, &RED)).unwrap() .label("true values") .legend(|(x, y)| PathElement::new(vec![(x, y), (x + 1, y)], &RED)); // add the second plot - let mut data2: Vec<(f64,f64)> = x_test.iter().zip(y_test_pred.iter()) + let data2: Vec<(f64,f64)> = x_test.iter().zip(y_test_pred.iter()) .map(|(x, y)| (x[0], y[0])) .collect(); - data2.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap()); chart .draw_series(LineSeries::new(data2, &BLUE)).unwrap() .label("predicted values")