Skip to main content

Module obj_func

Function get_obj_func

View Source

get_obj_func(model_type: str, features_df: DataFrame, use_individual_lesions: bool, features_used: list, num_hp_cv_repeats: int, num_workers: int, exclude_num_first_columns: int, num_cv_folds: int) -> Callable[]

Determines objective function from provided parameters for hyperparameter optimization. This function creates a callable that evaluates model performance with given hyperparameters and returns a loss value suitable for hyperopt optimization.

Args: model_type (str): Type of model to be optimized (e.g., 'random_forest', 'xgboost') features_df (pd.DataFrame): Input data containing features and target variables config (BaseConfig): Configuration object containing training parameters and settings

Raises: NotImplementedError: Currently only RandomForest and Logistic Regression model type is fully implemented

Returns: Callable: Objective function that takes hyperparameters as input and returns a dictionary with loss value and optimization status