hydraflow 0.2.4__tar.gz → 0.2.5__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. {hydraflow-0.2.4 → hydraflow-0.2.5}/PKG-INFO +2 -2
  2. {hydraflow-0.2.4 → hydraflow-0.2.5}/README.md +1 -1
  3. {hydraflow-0.2.4 → hydraflow-0.2.5}/pyproject.toml +1 -1
  4. {hydraflow-0.2.4 → hydraflow-0.2.5}/src/hydraflow/runs.py +34 -0
  5. {hydraflow-0.2.4 → hydraflow-0.2.5}/tests/test_runs.py +15 -0
  6. {hydraflow-0.2.4 → hydraflow-0.2.5}/.devcontainer/devcontainer.json +0 -0
  7. {hydraflow-0.2.4 → hydraflow-0.2.5}/.devcontainer/postCreate.sh +0 -0
  8. {hydraflow-0.2.4 → hydraflow-0.2.5}/.devcontainer/starship.toml +0 -0
  9. {hydraflow-0.2.4 → hydraflow-0.2.5}/.gitattributes +0 -0
  10. {hydraflow-0.2.4 → hydraflow-0.2.5}/.gitignore +0 -0
  11. {hydraflow-0.2.4 → hydraflow-0.2.5}/LICENSE +0 -0
  12. {hydraflow-0.2.4 → hydraflow-0.2.5}/src/hydraflow/__init__.py +0 -0
  13. {hydraflow-0.2.4 → hydraflow-0.2.5}/src/hydraflow/asyncio.py +0 -0
  14. {hydraflow-0.2.4 → hydraflow-0.2.5}/src/hydraflow/config.py +0 -0
  15. {hydraflow-0.2.4 → hydraflow-0.2.5}/src/hydraflow/context.py +0 -0
  16. {hydraflow-0.2.4 → hydraflow-0.2.5}/src/hydraflow/mlflow.py +0 -0
  17. {hydraflow-0.2.4 → hydraflow-0.2.5}/tests/scripts/__init__.py +0 -0
  18. {hydraflow-0.2.4 → hydraflow-0.2.5}/tests/scripts/log_run.py +0 -0
  19. {hydraflow-0.2.4 → hydraflow-0.2.5}/tests/scripts/watch.py +0 -0
  20. {hydraflow-0.2.4 → hydraflow-0.2.5}/tests/test_asyncio.py +0 -0
  21. {hydraflow-0.2.4 → hydraflow-0.2.5}/tests/test_config.py +0 -0
  22. {hydraflow-0.2.4 → hydraflow-0.2.5}/tests/test_context.py +0 -0
  23. {hydraflow-0.2.4 → hydraflow-0.2.5}/tests/test_log_run.py +0 -0
  24. {hydraflow-0.2.4 → hydraflow-0.2.5}/tests/test_mlflow.py +0 -0
  25. {hydraflow-0.2.4 → hydraflow-0.2.5}/tests/test_version.py +0 -0
  26. {hydraflow-0.2.4 → hydraflow-0.2.5}/tests/test_watch.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hydraflow
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Hydraflow integrates Hydra and MLflow to manage and track machine learning experiments.
5
5
  Project-URL: Documentation, https://github.com/daizutabi/hydraflow
6
6
  Project-URL: Source, https://github.com/daizutabi/hydraflow
@@ -48,7 +48,7 @@ Description-Content-Type: text/markdown
48
48
 
49
49
  ## Overview
50
50
 
51
- Hydraflow is a powerful library designed to seamlessly integrate
51
+ Hydraflow is a library designed to seamlessly integrate
52
52
  [Hydra](https://hydra.cc/) and [MLflow](https://mlflow.org/), making it easier to
53
53
  manage and track machine learning experiments. By combining the flexibility of
54
54
  Hydra's configuration management with the robust experiment tracking capabilities
@@ -17,7 +17,7 @@
17
17
 
18
18
  ## Overview
19
19
 
20
- Hydraflow is a powerful library designed to seamlessly integrate
20
+ Hydraflow is a library designed to seamlessly integrate
21
21
  [Hydra](https://hydra.cc/) and [MLflow](https://mlflow.org/), making it easier to
22
22
  manage and track machine learning experiments. By combining the flexibility of
23
23
  Hydra's configuration management with the robust experiment tracking capabilities
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "hydraflow"
7
- version = "0.2.4"
7
+ version = "0.2.5"
8
8
  description = "Hydraflow integrates Hydra and MLflow to manage and track machine learning experiments."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -501,6 +501,33 @@ class RunCollection:
501
501
  """
502
502
  return (func(download_artifacts(run_id=run.info.run_id)) for run in self._runs)
503
503
 
504
+ def group_by(
505
+ self, names: list[str] | None = None, *args
506
+ ) -> dict[tuple[str, ...], RunCollection]:
507
+ """
508
+ Group the runs by the specified parameter names and return a dictionary
509
+ where the keys are the parameter values and the values are the runs.
510
+
511
+ Args:
512
+ names (list[str] | None): The parameter names to group by.
513
+ *args: Additional positional arguments to specify parameter names.
514
+
515
+ Returns:
516
+ A dictionary where the keys are the parameter values and the values
517
+ are the runs.
518
+ """
519
+ names = names[:] if names else []
520
+ names.extend(args)
521
+
522
+ grouped_runs = {}
523
+ for run in self._runs:
524
+ key = get_params(run, names)
525
+ if key not in grouped_runs:
526
+ grouped_runs[key] = []
527
+ grouped_runs[key].append(run)
528
+
529
+ return {key: RunCollection(runs) for key, runs in grouped_runs.items()}
530
+
504
531
 
505
532
  def _param_matches(run: Run, key: str, value: Any) -> bool:
506
533
  """
@@ -765,6 +792,13 @@ def try_get_run(runs: list[Run], config: object | None = None, **kwargs) -> Run
765
792
  raise ValueError(msg)
766
793
 
767
794
 
795
+ def get_params(run: Run, names: list[str] | None = None, *args) -> tuple[str, ...]:
796
+ names = names[:] if names else []
797
+ names.extend(args)
798
+
799
+ return tuple(run.data.params[name] for name in names)
800
+
801
+
768
802
  def get_param_names(runs: list[Run]) -> list[str]:
769
803
  """
770
804
  Get the parameter names from the runs.
@@ -419,6 +419,21 @@ def test_run_collection_contains(runs: RunCollection, i: int):
419
419
  assert runs._runs[i] in runs
420
420
 
421
421
 
422
+ def test_run_collection_group_by(runs: RunCollection):
423
+ grouped = runs.group_by(["p"])
424
+ assert len(grouped) == 6
425
+ assert all(isinstance(group, RunCollection) for group in grouped.values())
426
+ assert all(len(group) == 1 for group in grouped.values())
427
+ assert grouped[("0",)][0] == runs[0]
428
+ assert grouped[("1",)][0] == runs[1]
429
+
430
+ grouped = runs.group_by(["q"])
431
+ assert len(grouped) == 2
432
+
433
+ grouped = runs.group_by(["r"])
434
+ assert len(grouped) == 3
435
+
436
+
422
437
  # def test_hydra_output_dir_error(runs_list: list[Run]):
423
438
  # from hydraflow.runs import get_hydra_output_dir
424
439
 
File without changes
File without changes
File without changes
File without changes