Data loading
neps.utils.data_loading
#
Utility functions for loading data from disk.
get_id_from_path
#
Extracts the id from the given path.
The id is the last part of the path, which is a multiple digit number.
Note
I think this refers to task ids and not config ids!!!
Source code in neps/utils/data_loading.py
is_valid_dev_path
#
Checks if the given path is a valid path to development stages.
It follows the pattern task_00000/dev_00000, where 00000 is replaced by the task and development stage ids.
Source code in neps/utils/data_loading.py
is_valid_seed_path
#
Checks if the given path is a valid path to a seed.
It follows the pattern seed_00000, where 00000 is replaced by the seed.
Source code in neps/utils/data_loading.py
is_valid_task_path
#
Checks if the given path is a valid task path.
It follows the pattern task_00000, where 00000 is replaced by the task id.
Source code in neps/utils/data_loading.py
read_tasks_and_dev_stages_from_disk
#
read_tasks_and_dev_stages_from_disk(
paths: list[str | Path],
) -> dict[int, dict[int, dict[str, ConfigResult]]]
Reads the given tasks and dev stages from the disk.
PARAMETER | DESCRIPTION |
---|---|
paths |
List of paths to the previous runs. |
RETURNS | DESCRIPTION |
---|---|
dict[int, dict[int, dict[str, ConfigResult]]]
|
dict[task_id, dict[dev_stage, dict[config_id, ConfigResult]]. |
Source code in neps/utils/data_loading.py
read_user_prior_results_from_disk
#
Reads the user prior results from the disk.
PARAMETER | DESCRIPTION |
---|---|
path |
Path to the user prior results. |
RETURNS | DESCRIPTION |
---|---|
dict[str, dict[str, ConfigResult]]
|
dict[prior_dir_name, dict[hyperparameter, value]. |
Source code in neps/utils/data_loading.py
summarize_results
#
summarize_results(
working_dir: str | Path,
final_task_id: int | None = None,
final_dev_id: int | None = None,
sub_dir: str = "",
*,
write_to_file: bool = True
) -> BestLossesDict
Summarizes the results of the given working directory.
This includes runs over multiple seeds. The results are saved in the working directory.
PARAMETER | DESCRIPTION |
---|---|
working_dir |
path to the working directory that contains directories for all seeds |
final_task_id |
id of the tasks whose results should be summarized. If None, all tasks are summarized.
TYPE:
|
final_dev_id |
if of the development stage whose results should be summarized. If None, all development stages are summarized.
TYPE:
|
sub_dir |
subdirectory to look into for specific seeds.
* If subdir is provided:
TYPE:
|
write_to_file |
if True, the results are written to a file in the working
directory, using the latest taks and dev stage ids.
TYPE:
|
Source code in neps/utils/data_loading.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
|
summarize_results_all_tasks_all_devs
#
summarize_results_all_tasks_all_devs(
path: str | Path,
sub_dir: str = "",
file_name: str = "summary",
user_prior_dir: str | Path | None = None,
) -> Any
Summarizes the results of all tasks and all development stages.
This includes runs overrmultiple seeds. The results are saved in the working directory.