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]

[src]

DataSet constructor.

Examples

use neuroflow::data::DataSet;

let mut data = DataSet::new();

[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 to csv file;
  • return -> Result<DataSet, Box<std::error::Error>> - return new DataSet 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);
}

[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]

[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]

[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);

[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]);

[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);

Trait Implementations

impl Debug for DataSet
[src]

[src]

Formats the value using the given formatter.

impl Extractable for DataSet
[src]

[src]

Get random element from set Read more

[src]

Get element from set by index Read more

[src]

Get length of set Read more