hydraflow 0.2.4__py3-none-any.whl → 0.2.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
hydraflow/runs.py CHANGED
@@ -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.
@@ -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
@@ -3,8 +3,8 @@ hydraflow/asyncio.py,sha256=yh851L315QHzRBwq6r-uwO2oZKgz1JawHp-fswfxT1E,6175
3
3
  hydraflow/config.py,sha256=6TCKNQZ3sSrIEvl245T2udwFuknejyN1dMcIVmOHdrQ,2102
4
4
  hydraflow/context.py,sha256=8Qn99yCSkCarDDthQ6hjgW80CBBIg0H7fnLvtw4ZXo8,7248
5
5
  hydraflow/mlflow.py,sha256=gGr0fvFEllduA-ByHMeEamM39zVY_30tjtEbkSZ4lHA,3659
6
- hydraflow/runs.py,sha256=0t2xhjV9DMA1CNDzBYrsHiZrDZ6cNsaSTxi0ikf6k8c,29907
7
- hydraflow-0.2.4.dist-info/METADATA,sha256=Rw8m1Ir6Lio6jja44oPHnSMdlLbK2KtZ46UQRD38Lq8,4148
8
- hydraflow-0.2.4.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
9
- hydraflow-0.2.4.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
10
- hydraflow-0.2.4.dist-info/RECORD,,
6
+ hydraflow/runs.py,sha256=41P2aIm7Alem3uKHd-JJdoDzzA4LwrO0rIIZKqZGmdc,31071
7
+ hydraflow-0.2.5.dist-info/METADATA,sha256=KDDgZxTmODbd9fSiwLrURTk7il53CQzGkpGrAshPp1s,4139
8
+ hydraflow-0.2.5.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
9
+ hydraflow-0.2.5.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
10
+ hydraflow-0.2.5.dist-info/RECORD,,