pub fn add_row(&mut self, features: &[f64], target: f64) -> Result<(), TableError> {
        if self.columns.is_empty() {
            self.columns = vec![Vec::new(); features.len() + 1];
        }

        if self.columns.len() != features.len() + 1 {
            return Err(TableError::ColumnSizeMismatch);
        }

        if !target.is_finite() {
            return Err(TableError::NonFiniteTarget);
        }

        if self.column_types.is_empty() {
            self.column_types = (0..features.len()).map(|_| ColumnType::Numerical).collect();
        }

        for (column, value) in self
            .columns
            .iter_mut()
            .zip(features.iter().copied().chain(std::iter::once(target)))
        {
            column.push(value);
        }

        Ok(())
    }
/// Adds a row to the table.
Adds a row to the table.
Adds a row to the table .
pub fn add_row(&mut self, features: &[f64], target: f64) -> Result<(), TableError> {
        if self.columns.is_empty() {
            self.columns = vec![Vec::new(); features.len() + 1];
        }
        if self.columns.len() != features.len() + 1 {
            return Err(TableError::ColumnSizeMismatch);
        }
        if !target.is_finite() {
            return Err(TableError::NonFiniteTarget);
        }
        if self.column_types.is_empty() {
            self.column_types = (0..features.len()).map(|_| ColumnType::Numerical).collect();
        }
        for (column, value) in self
            .columns
            .iter_mut()
            .zip(features.iter().copied().chain(std::iter::once(target)))
        {
            column.push(value);
        }
        Ok(())
    }
pub fn add_row ( & mut self , features : & [ f64 ] , target : f64 ) -> Result < ( ) , TableError > { if self . columns . is_empty ( ) { self . columns = vec ! [ Vec new ( ) features len ( ) 1 ] ; } if self . columns . len ( ) != features . len ( ) + 1 { return Err ( TableError :: ColumnSizeMismatch ) ; } if ! target . is_finite ( ) { return Err ( TableError :: NonFiniteTarget ) ; } if self . column_types . is_empty ( ) { self . column_types = ( 0 .. features . len ( ) ) . map ( | _ | ColumnType :: Numerical ) . collect ( ) ; } for ( column , value ) in self . columns . iter_mut ( ) . zip ( features . iter ( ) . copied ( ) . chain ( std :: iter :: once ( target ) ) ) { column . push ( value ) ; } Ok ( ( ) ) }
Adds a row to the table.
Adds a row to the table .
&mut self
features
&[f64]
target
f64
&mut self
features
&[f64]
target
f64