AlgorithmWrapper#

class AlgorithmWrapper(name: str, display_name: str, algorithm_class: Type, default_params: Dict[str, Any] | None = None, hyperparam_grid: Dict[str, Any] | None = None)#

A wrapper class for machine learning algorithms.

Provides methods to instantiate models with default or tuned parameters and manages hyperparameter grids for model tuning.

Parameters:
namestr

Identifier for the algorithm

display_namestr

Human-readable name for display purposes

algorithm_classType

The class of the algorithm to be instantiated

default_paramsdict, optional

Default parameters for model instantiation, by default None

hyperparam_griddict, optional

Grid of parameters for hyperparameter tuning, by default None

Attributes:
namestr

Algorithm identifier

display_namestr

Human-readable name

algorithm_classType

The algorithm class

default_paramsdict

Current default parameters

hyperparam_griddict

Current hyperparameter grid

get_hyperparam_grid() Dict[str, Any]#

Get the hyperparameter grid.

Returns:
dict

Current hyperparameter grid

instantiate() Any#

Instantiate model with default parameters.

Returns:
Any

Model instance with default parameters and wrapper name attribute

instantiate_tuned(best_params: Dict[str, Any]) Any#

Instantiate model with tuned parameters.

Parameters:
best_paramsdict

Tuned hyperparameters

Returns:
Any

Model instance with tuned parameters and wrapper name attribute

Notes

If max_iter is specified in default_params, it will be preserved in the tuned parameters.

to_markdown() str#

Create markdown representation of algorithm configuration.

Returns:
str

Markdown formatted string containing algorithm name and class, default parameters, and hyperparameter grid.