Removed sorting the training set for plotting as it isn't needed (anymore)
This commit is contained in:
parent
b840dd6d8f
commit
cd47bd7d12
1 changed files with 2 additions and 4 deletions
|
@ -79,20 +79,18 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
.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")
|
||||
|
|
Loading…
Reference in a new issue