ml_grid.model_classes.gaussiannb_class

Defines the GaussianNB model class..

Classes

GaussianNBWrapper

A wrapper for GaussianNB to handle integer-mapped priors for Bayesian search.

GaussianNBClassifierClass

Initializes the GaussianNBClassifierClass.

Module Contents

class ml_grid.model_classes.gaussiannb_class.GaussianNBWrapper(*, priors=None, var_smoothing=1e-09)[source]

Bases: sklearn.naive_bayes.GaussianNB

A wrapper for GaussianNB to handle integer-mapped priors for Bayesian search.

This wrapper allows for the use of integer-based categorical variables for the ‘priors’ parameter in Bayesian optimization, which is then mapped to the actual list of prior probabilities.

set_params(**params: Any) GaussianNBWrapper[source]

Sets the parameters of the estimator.

This method intercepts the ‘priors’ parameter if it’s an integer index and maps it to the corresponding list of prior probabilities before passing it to the parent’s set_params method.

Parameters:

**params – Estimator parameters.

Returns:

The instance with updated parameters.

class ml_grid.model_classes.gaussiannb_class.GaussianNBClassifierClass(X: pandas.DataFrame | None = None, y: pandas.Series | None = None, parameter_space_size: str | None = None)[source]

Initializes the GaussianNBClassifierClass.

Parameters:
  • X (Optional[pd.DataFrame]) – The input features. Defaults to None.

  • y (Optional[pd.Series]) – The target variable. Defaults to None.

  • parameter_space_size (Optional[str]) – The size of the parameter space. Defaults to None.

Raises:

ValueError – If parameter_space_size is not a valid key (though current implementation does not explicitly raise this).

X: pandas.DataFrame | None = None[source]
y: pandas.Series | None = None[source]
method_name: str = 'GaussianNB'[source]
parameter_space: Dict[str, Any][source]