library.phases.phases_implementation.modelling.modelling module

class library.phases.phases_implementation.modelling.modelling.Modelling(dataset: Dataset, model_results_path: str)[source]

Bases: object

add_model(model_name: str, model_sklearn: object, model_type: str = 'classical')[source]

Adds a new model to the list of models.

Parameters:
  • model_name (str)

  • model. (The name to assign to the new)

  • model_sklearn (object)

  • added. (The sklearn model object to be)

  • model_type (str, optional (default="classical"))

  • of (The type of model being added. Must be one)

  • "classical" (-)

  • "neural_network" (-)

  • "stacking" (-)

Notes

Once a model is added, the dataset cannot be modified.

Raises:
  • AssertionError

  • If model_type is not one of the accepted values.

evaluate_and_store_models(current_phase: str, **kwargs) DataFrame | None[source]

It asses each model and stores the results in the results_df.

Parameters:
  • comments (str) – The comments to store in the results_df (and in disk)

  • current_phase (str) – The current phase of the modelling

  • kwargs (dict) – Additional keyword arguments defining phase-specific parameters

Returns:

The results of the evaluation

Return type:

pd.DataFrame or None

fit_models(current_phase: str, **kwargs)[source]

Fits or optimizes models depending on the current phase.

Parameters:
  • current_phase (str) – Phase of operation: “pre”, “in”, or “post”.

  • kwargs (dict) – Additional arguments for optimization or fitting (e.g., modelNameToOptimizer).

Notes

  • Models are optimized in parallel, except “bayes_nn” models which run sequentially.

  • Returns optimized models dictionary during the “in” phase, else None.

property models_to_exclude