Struct neuroflow::data::DataSet
[−]
[src]
pub struct DataSet { /* fields omitted */ }
Container for data storage. It is not important to use it but it can significantly
simplify the work with NeuroFlow
crate.
Examples
use std::path::Path; use neuroflow::data::DataSet; /* You can load data from csv files */ let p = "container.csv"; if Path::new(p).exists(){ let mut data = DataSet::from_csv(p).unwrap(); /* Fetch statistical information */ let (x, y) = data.mean(); /* Round all elements at once with precision */ data.round(2); } /* etc */
Methods
impl DataSet
[src]
fn new() -> DataSet
[src]
fn from_csv(file_path: &str) -> Result<DataSet, Box<Error>>
[src]
Read data from csv file and parse it to the DataSet
instance.
The file must not have header. Input vector must be separated from desired output
by -
symbol like in the following:
1,0,1,-,1,2
2,3,0,-,2,3,1
file_path: &str
- path tocsv
file;return -> Result<DataSet, Box<std::error::Error>>
- return newDataSet
instance if Ok.
Examples
use std::path::Path; use neuroflow::data::DataSet; let p = "container.csv"; if Path::new(p).exists(){ let mut data = DataSet::from_csv(p).unwrap(); println!("{:?}", data); }
fn sum(&self) -> (Vec<f64>, Vec<f64>)
[src]
Find sum of elements by columns in DataSet
Examples
use neuroflow::data::DataSet; let mut data = DataSet::new(); data.push(&[1.3], &[1.2, 2.1]); data.push(&[1.1], &[1.0, 2.0]); let (x, y) = data.sum(); println!("{:?} {:?}", x, y);
Expected output
[2.4] [2.2, 2.1]
fn mean(&self) -> (Vec<f64>, Vec<f64>)
[src]
Find mean value of each column in DataSet
Examples
use neuroflow::data::DataSet; let mut data = DataSet::new(); data.push(&[1.3], &[1.2, 2.1]); data.push(&[1.1], &[1.0, 2.0]); let (x, y) = data.mean(); println!("{:?} {:?}", x, y);
Expected output
[1.2] [1.1, 1.05]
fn round(&mut self, precision: u32)
[src]
Round each value in DataSet
with the given precision.
precision: u32
- amount of digits after point that must be remained after rounding
Examples
use neuroflow::data::DataSet; let mut data = DataSet::new(); data.push(&[1.3456465], &[1.259898, 2.1113213]); data.push(&[1.11132132132], &[1.04848, 2.0548487]); data.round(2);
fn push(&mut self, x: &[f64], y: &[f64])
[src]
Append data to the end of the set.
x: &[f64]
- input data to neural network;y: &[f64]
- expected output of neural network.
Examples
use neuroflow::data::DataSet; let mut data = DataSet::new(); data.push(&[1.3], &[1.2, 2.1]);
fn remove(&mut self, i: usize)
[src]
Remove element by index from set
i: usize
- index of element to be deleted.
Examples
use neuroflow::data::DataSet; let mut data = DataSet::new(); data.push(&[1.3], &[1.2, 2.1]); data.remove(0);