Util
Utility functions for trial configuration key mapping and ID assignment.
get_config_key_to_id_mapping
#
get_config_key_to_id_mapping(
table: DataFrame, fid_name: str
) -> dict[tuple[tuple[str, Any], ...], int]
Map each unique trial configuration (excluding fidelity) to its highest config ID.
| PARAMETER | DESCRIPTION |
|---|---|
table
|
DataFrame with trial configurations and IDs.
TYPE:
|
fid_name
|
Name of the fidelity parameter to exclude.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[tuple[tuple[str, Any], ...], int]
|
Dictionary mapping unique config keys to their highest config ID. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If table is not a pandas DataFrame. |
Source code in neps\optimizers\utils\util.py
get_trial_config_unique_key
#
get_trial_config_unique_key(
config: Mapping[str, Any], fid_name: str | None = None
) -> tuple[tuple[str, Any], ...]
Generate a unique key for a trial configuration, optionally excluding the fidelity parameter.
| PARAMETER | DESCRIPTION |
|---|---|
config
|
Mapping of configuration parameters. |
fid_name
|
Name of the fidelity parameter to exclude (if any).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[tuple[str, Any], ...]
|
A tuple of (key, value) pairs sorted by key, excluding the fidelity parameter if specified. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If config is not a mapping. |