pub struct ObjectiveFactory;Expand description
Factory for creating objective function instances.
ObjectiveFactory provides static methods to instantiate objective
functions with appropriate types and parameters. It handles validation
and configuration of objective-specific hyperparameters.
Implementations§
Source§impl ObjectiveFactory
impl ObjectiveFactory
Sourcepub fn create_regression_objective(
name: &str,
) -> ObjectiveResult<Box<dyn RegressionObjective>>
pub fn create_regression_objective( name: &str, ) -> ObjectiveResult<Box<dyn RegressionObjective>>
Creates a regression objective function by name.
§Supported Names
mse,mean_squared_errormae,mean_absolute_errorhuber(creates with delta=1.0)
§Parameters
name: Objective function name (case-insensitive)
§Returns
Boxed trait object implementing RegressionObjective
§Errors
ObjectiveError::ConfigErrorifnameis not a valid regression objective
Sourcepub fn create_binary_classification_objective(
name: &str,
) -> ObjectiveResult<Box<dyn BinaryClassificationObjective>>
pub fn create_binary_classification_objective( name: &str, ) -> ObjectiveResult<Box<dyn BinaryClassificationObjective>>
Creates a binary classification objective function by name.
§Supported Names
log_loss,binary_crossentropy,binary_cross_entropy
§Parameters
name: Objective function name (case-insensitive)
§Returns
Boxed trait object implementing BinaryClassificationObjective
§Errors
ObjectiveError::ConfigErrorifnameis not a valid classification objective
Sourcepub fn create_objective_from_config(
config: &ObjectiveConfig,
) -> ObjectiveResult<Box<dyn Objective>>
pub fn create_objective_from_config( config: &ObjectiveConfig, ) -> ObjectiveResult<Box<dyn Objective>>
Creates an objective from a configuration struct.
§Parameters
config:ObjectiveConfigwith name and parameters
§Returns
Boxed trait object implementing Objective
§Supported Configurations
mse: No parametersmae: No parametershuber:deltaparameter (default: 1.0)log_loss:epsilonparameter (default: 1e-15)
§Errors
ObjectiveError::ConfigErrorif objective name is unknownObjectiveError::ConfigErrorif parameters are invalid
Sourcepub fn get_objective_type(name: &str) -> ObjectiveResult<ObjectiveType>
pub fn get_objective_type(name: &str) -> ObjectiveResult<ObjectiveType>
Determines the task type for a given objective name.
§Parameters
name: Objective name (case-insensitive)
§Returns
ObjectiveType indicating regression or classification
§Errors
ObjectiveError::ConfigErrorif objective name is unknown
Sourcepub fn available_objectives() -> Vec<&'static str>
pub fn available_objectives() -> Vec<&'static str>
Sourcepub fn get_default_params(name: &str) -> ObjectiveResult<HashMap<String, f64>>
pub fn get_default_params(name: &str) -> ObjectiveResult<HashMap<String, f64>>
Auto Trait Implementations§
impl Freeze for ObjectiveFactory
impl RefUnwindSafe for ObjectiveFactory
impl Send for ObjectiveFactory
impl Sync for ObjectiveFactory
impl Unpin for ObjectiveFactory
impl UnwindSafe for ObjectiveFactory
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 more