Search space
neps.search_spaces.search_space
#
SearchSpace
#
Source code in neps/search_spaces/search_space.py
set_custom_grid_space
#
set_custom_grid_space(
grid_table: Series | DataFrame,
raw_space: SearchSpace | ConfigurationSpace,
)
Set a custom grid space for the search space.
This function is used to set a custom grid space for the pipeline space. NOTE: Only to be used if a custom set of hyperparameters from the search space is to be sampled or used for acquisition functions. WARNING: The type check and the table format requirement is loose and can break certain components.
Source code in neps/search_spaces/search_space.py
pipeline_space_from_yaml
#
pipeline_space_from_yaml(
yaml_file_path: str | Path,
) -> dict[
str,
FloatParameter
| IntegerParameter
| CategoricalParameter
| ConstantParameter,
]
Reads configuration details from a YAML file and constructs a pipeline space dictionary.
This function extracts parameter configurations from a YAML file, validating and translating them into corresponding parameter objects. The resulting dictionary maps parameter names to their respective configuration objects.
PARAMETER | DESCRIPTION |
---|---|
yaml_file_path |
Path to the YAML file containing parameter |
RETURNS | DESCRIPTION |
---|---|
dict
|
A dictionary where keys are parameter names and values are parameter objects (like IntegerParameter, FloatParameter, etc.).
TYPE:
|
RAISES | DESCRIPTION |
---|---|
SearchSpaceFromYamlFileError
|
This custom exception is raised if there are issues |
Note
The YAML file should be properly structured with valid keys and values as per the expected parameter types. The function employs modular validation and type deduction logic, ensuring each parameter's configuration adheres to expected formats and constraints. Any deviation results in an appropriately raised error, which is then captured by SearchSpaceFromYamlFileError for streamlined error handling.
Example
To use this function with a YAML file 'config.yaml', you can do: pipeline_space = pipeline_space_from_yaml('config.yaml')
Source code in neps/search_spaces/search_space.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|