Struct linregress::RegressionDataBuilder [−][src]
pub struct RegressionDataBuilder { /* fields omitted */ }A builder to create a RegressionData struct for use with a FormulaRegressionBuilder.
Implementations
impl RegressionDataBuilder[src]
impl RegressionDataBuilder[src]pub fn new() -> Self[src]
Create a new RegressionDataBuilder.
pub fn invalid_value_handling(self, setting: InvalidValueHandling) -> Self[src]
Configure how to handle non real f64 values (NaN or infinity or negative infinity) using
a variant of the InvalidValueHandling enum.
The default value is ReturnError.
Example
use linregress::{InvalidValueHandling, RegressionDataBuilder}; let builder = RegressionDataBuilder::new(); let builder = builder.invalid_value_handling(InvalidValueHandling::DropInvalid);
pub fn build_from<'a, I, S>(self, data: I) -> Result<RegressionData<'a>, Error> where
I: IntoIterator<Item = (S, Vec<f64>)>,
S: Into<Cow<'a, str>>, [src]
I: IntoIterator<Item = (S, Vec<f64>)>,
S: Into<Cow<'a, str>>,
Build a RegressionData struct from the given data.
Any type that implements the IntoIterator trait can be used for the data.
This could for example be a Hashmap or a Vec.
The iterator must consist of tupels of the form (S, Vec<f64>) where
S is a type that implements Into<Cow<str>>, such as String or str.
You can think of this format as the representation of a table of data where
each tuple (S, Vec<f64>) represents a column. The S is the header or label of the
column and the Vec<f64> contains the data of the column.
Because ~ and + are used as separators in the formula they may not be used in the name
of a data column.
Example
use std::collections::HashMap; use linregress::RegressionDataBuilder; let mut data1 = HashMap::new(); data1.insert("Y", vec![1., 2., 3., 4.]); data1.insert("X", vec![4., 3., 2., 1.]); let regression_data1 = RegressionDataBuilder::new().build_from(data1)?; let y = vec![1., 2., 3., 4.]; let x = vec![4., 3., 2., 1.]; let data2 = vec![("X", x), ("Y", y)]; let regression_data2 = RegressionDataBuilder::new().build_from(data2)?;
Trait Implementations
impl Clone for RegressionDataBuilder[src]
impl Clone for RegressionDataBuilder[src]fn clone(&self) -> RegressionDataBuilder[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Default for RegressionDataBuilder[src]
impl Default for RegressionDataBuilder[src]fn default() -> RegressionDataBuilder[src]
impl Copy for RegressionDataBuilder[src]
Auto Trait Implementations
impl RefUnwindSafe for RegressionDataBuilder
impl Send for RegressionDataBuilder
impl Sync for RegressionDataBuilder
impl Unpin for RegressionDataBuilder
impl UnwindSafe for RegressionDataBuilder
Blanket Implementations
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>, [src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>, [src]