pub trait ParamGuard {
    type Checked;
    type Error: Error;

    // Required methods
    fn check_ref(&self) -> Result<&Self::Checked, Self::Error>;
    fn check(self) -> Result<Self::Checked, Self::Error>;

    // Provided method
    fn check_unwrap(self) -> Self::Checked
       where Self: Sized { ... }
}
Expand description

A set of hyperparameters whose values have not been checked for validity. A reference to the checked hyperparameters can only be obtained after checking has completed. If the Transformer, Fit, or FitWith traits have been implemented on the checked hyperparameters, they will also be implemented on the unchecked hyperparameters with the checking step done automatically.

The hyperparameter validation done in check_ref() and check() should be identical.

Required Associated Types§

source

type Checked

The checked hyperparameters

source

type Error: Error

Error type resulting from failed hyperparameter checking

Required Methods§

source

fn check_ref(&self) -> Result<&Self::Checked, Self::Error>

Checks the hyperparameters and returns a reference to the checked hyperparameters if successful

source

fn check(self) -> Result<Self::Checked, Self::Error>

Checks the hyperparameters and returns the checked hyperparameters if successful

Provided Methods§

source

fn check_unwrap(self) -> Self::Checked
where Self: Sized,

Calls check() and unwraps the result

Implementors§