fusionlab.nn.forecast_tuner.HALTuner

class fusionlab.nn.forecast_tuner.HALTuner[source]

Bases: PINNTunerBase

A Keras Tuner for hyperparameter optimization of the HALNet model.

This class inherits from PINNTunerBase and implements the build method to construct and compile HALNet instances with different hyperparameter combinations.

Parameters:
  • fixed_model_params (Dict[str, Any]) – A dictionary of parameters for the HALNet model that remain constant during tuning. This must include static_input_dim, dynamic_input_dim, and future_input_dim.

  • param_space (Dict[str, Any], optional) – A dictionary defining the hyperparameter search space. If not provided, a default search space within the build method is used.

  • objective (str or keras_tuner.Objective, default 'val_loss') – The metric to optimize during the search.

  • max_trials (int, default 20) – The maximum number of hyperparameter combinations to test.

  • project_name (str, default "HALNet_Tuning") – The name for the tuning project.

  • **tuner_kwargs (Any) – Additional keyword arguments passed to the PINNTunerBase and underlying Keras Tuner constructor (e.g., tuner_type, seed).

__init__(fixed_model_params, param_space=None, objective='val_loss', max_trials=20, directory='hal_tuner_results', executions_per_trial=1, tuner_type='randomsearch', seed=None, overwrite_tuner=True, project_name='HALNet_Tuning', **tuner_kwargs)[source]

Initialize the base class.

Parameters:
  • verbose (int, optional) – Verbosity level controlling logging (0 to 3). Defaults to 0.

  • fixed_model_params (Dict[str, Any])

  • param_space (Dict[str, Any] | None)

  • objective (str | Objective)

  • max_trials (int)

  • directory (str)

  • executions_per_trial (int)

  • tuner_type (str)

  • seed (int | None)

  • overwrite_tuner (bool)

  • project_name (str)

Methods

__init__(fixed_model_params[, param_space, ...])

Initialize the base class.

build(hp)

Builds and compiles a HALNet model for a given trial.

create(inputs_data, targets_data[, ...])

A factory method to create a HALTuner instance by inferring dimensions from data.

declare_hyperparameters(hp)

fit(hp, model, *args, **kwargs)

Train the model.

help(**kwargs)

run(inputs, y[, validation_data, epochs, ...])

A user-friendly wrapper around the search method.

save([obj, file_path, format, encoding, ...])

Save the object's data to a specified file in the desired format.

search(train_data, epochs[, ...])

Performs the hyperparameter search using Keras Tuner.

Attributes

MAX_DISPLAY_ITEMS

my_params

__init__(fixed_model_params, param_space=None, objective='val_loss', max_trials=20, directory='hal_tuner_results', executions_per_trial=1, tuner_type='randomsearch', seed=None, overwrite_tuner=True, project_name='HALNet_Tuning', **tuner_kwargs)[source]

Initialize the base class.

Parameters:
  • verbose (int, optional) – Verbosity level controlling logging (0 to 3). Defaults to 0.

  • fixed_model_params (Dict[str, Any])

  • param_space (Dict[str, Any] | None)

  • objective (str | Objective)

  • max_trials (int)

  • directory (str)

  • executions_per_trial (int)

  • tuner_type (str)

  • seed (int | None)

  • overwrite_tuner (bool)

  • project_name (str)

build(hp)[source]

Builds and compiles a HALNet model for a given trial.

Parameters:

hp (HyperParameters)

Return type:

Model

classmethod create(inputs_data, targets_data, fixed_model_params=None, verbose=1, **kwargs)[source]

A factory method to create a HALTuner instance by inferring dimensions from data.

Parameters:
  • inputs_data (List[ndarray])

  • targets_data (ndarray)

  • fixed_model_params (Dict[str, Any] | None)

  • verbose (int)

Return type:

HALTuner

help(**kwargs)
my_params = HALTuner(     fixed_model_params,     param_space=None,     objective='val_loss',     max_trials=20,     directory='hal_tuner_results',     executions_per_trial=1,     tuner_type='randomsearch',     seed=None,     overwrite_tuner=True,     project_name='HALNet_Tuning' )
run(inputs, y, validation_data=None, epochs=10, batch_size=32, **search_kwargs)[source]

A user-friendly wrapper around the search method. It creates tf.data.Dataset objects before initiating the search.

Parameters:
  • inputs (List[ndarray])

  • y (ndarray)

  • validation_data (Tuple[List[ndarray], ndarray] | None)

  • epochs (int)

  • batch_size (int)