Struct ElasticNet

Source
pub struct ElasticNet {
    pub features: Value<NDArray<f64>>,
    pub outputs: Value<NDArray<f64>>,
    pub weights: Value<NDArray<f64>>,
    pub bias: Value<NDArray<f64>>,
    /* private fields */
}

Fields§

§features: Value<NDArray<f64>>§outputs: Value<NDArray<f64>>§weights: Value<NDArray<f64>>§bias: Value<NDArray<f64>>

Implementations§

Source§

impl ElasticNet

Source

pub fn new( features: &NDArray<f64>, y: &NDArray<f64>, lambda: f64, learning_rate: f64, ) -> Result<ElasticNet, String>

Create new instance of elastic net regression

Source

pub fn predict(&mut self, inputs: NDArray<f64>) -> NDArray<f64>

Predict features for elastic net regression

Source

pub fn save(&self, filepath: &str) -> Result<()>

Save parameters for elastic net regression

Source

pub fn load( filepath: &str, features: &NDArray<f64>, y: &NDArray<f64>, learning_rate: f64, lambda: f64, ) -> Result<ElasticNet>

Load parameters for elastic net regression

Source

pub fn train(&mut self, epochs: usize, log_output: bool)

Train elastic net regression model

Source

pub fn sgd(&mut self, epochs: usize, log_output: bool, batch_size: usize)

Train elastic net regression model with batch gradient descent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.