pub struct ALS<T> { /* private fields */ }Implementations§
Source§impl ALS<f64>
impl ALS<f64>
Sourcepub fn new(n: usize, m: usize, k: usize) -> Self
pub fn new(n: usize, m: usize, k: usize) -> Self
Constructs a new ALS learner for an initially empty sparse matrix R of size N x M using K features for X and Y.
Sourcepub fn add(&mut self, e: RTriplet<f64>) -> Result<Option<f64>, ALSError<f64>>
pub fn add(&mut self, e: RTriplet<f64>) -> Result<Option<f64>, ALSError<f64>>
Adds a value to the sparse matrix R. Will overwrite a previous value if indices coincide.
Sourcepub fn reset_x(&mut self)
pub fn reset_x(&mut self)
Resets all entries of X with values uniformly sampled from (0, 1 / sqrt(K)).
Sourcepub fn reset_y(&mut self)
pub fn reset_y(&mut self)
Resets all entries of Y with values uniformly sampled from (0, 1 / sqrt(K)).
Sourcepub fn set_regularization(&mut self, lambda: f64)
pub fn set_regularization(&mut self, lambda: f64)
Sets the regularization factor.
pub fn set_default_iters(&mut self, iters: usize)
Sourcepub fn get_row_factors(&self, row: usize) -> Option<&DVector<f64>>
pub fn get_row_factors(&self, row: usize) -> Option<&DVector<f64>>
Get the feature vectors of the row
pub fn get_col_factors(&self, col: usize) -> Option<&DVector<f64>>
pub fn get_x(&self) -> &Vec<DVector<f64>> ⓘ
pub fn get_y(&self) -> &Vec<DVector<f64>> ⓘ
Sourcepub fn predict_r_val(&self, n: usize, m: usize) -> f64
pub fn predict_r_val(&self, n: usize, m: usize) -> f64
Predicts the value of R at some index.
Auto Trait Implementations§
impl<T> Freeze for ALS<T>where
T: Freeze,
impl<T> RefUnwindSafe for ALS<T>where
T: RefUnwindSafe,
impl<T> Send for ALS<T>where
T: Send,
impl<T> Sync for ALS<T>where
T: Sync,
impl<T> Unpin for ALS<T>where
T: Unpin,
impl<T> UnwindSafe for ALS<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.