pub struct Hyperparameters { /* private fields */ }
Expand description
Hyperparameters for a FactorizationMachine
Implementations§
Source§impl Hyperparameters
impl Hyperparameters
Sourcepub fn new(dim: usize, num_components: usize) -> Hyperparameters
pub fn new(dim: usize, num_components: usize) -> Hyperparameters
Creates new Hyperparameters.
The complexity of the model is controlled by the dimensionality of the factorization matrix:
a higher num_components
setting will make the model more expressive
at the expense of training time and risk of overfitting.
Sourcepub fn learning_rate(&mut self, learning_rate: f32) -> &mut Hyperparameters
pub fn learning_rate(&mut self, learning_rate: f32) -> &mut Hyperparameters
Set the initial learning rate.
During fitting, the learning rate decreases more for parameters which have have received larger gradient updates. This maintains more stable estimates for common features while allowing fast learning for rare features.
Sourcepub fn l2_penalty(&mut self, l2_penalty: f32) -> &mut Hyperparameters
pub fn l2_penalty(&mut self, l2_penalty: f32) -> &mut Hyperparameters
Set the L2 penalty.
Sourcepub fn l1_penalty(&mut self, l1_penalty: f32) -> &mut Hyperparameters
pub fn l1_penalty(&mut self, l1_penalty: f32) -> &mut Hyperparameters
Set the L1 penalty.
pub fn rng(&mut self, rng: StdRng) -> &mut Hyperparameters
Sourcepub fn build(&self) -> FactorizationMachine
pub fn build(&self) -> FactorizationMachine
Build a two-class model.
Sourcepub fn one_vs_rest(&self) -> OneVsRestWrapper<FactorizationMachine>
pub fn one_vs_rest(&self) -> OneVsRestWrapper<FactorizationMachine>
Build a one-vs-rest multiclass model.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hyperparameters
impl<'de> Deserialize<'de> for Hyperparameters
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Hyperparameters
impl RefUnwindSafe for Hyperparameters
impl Send for Hyperparameters
impl Sync for Hyperparameters
impl Unpin for Hyperparameters
impl UnwindSafe for Hyperparameters
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