hydraflow 0.18.1__py3-none-any.whl → 0.18.3__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/core/collection.py +8 -2
- hydraflow/core/run.py +22 -1
- hydraflow/core/run_collection.py +26 -0
- {hydraflow-0.18.1.dist-info → hydraflow-0.18.3.dist-info}/METADATA +1 -1
- {hydraflow-0.18.1.dist-info → hydraflow-0.18.3.dist-info}/RECORD +8 -8
- {hydraflow-0.18.1.dist-info → hydraflow-0.18.3.dist-info}/WHEEL +0 -0
- {hydraflow-0.18.1.dist-info → hydraflow-0.18.3.dist-info}/entry_points.txt +0 -0
- {hydraflow-0.18.1.dist-info → hydraflow-0.18.3.dist-info}/licenses/LICENSE +0 -0
hydraflow/core/collection.py
CHANGED
@@ -17,6 +17,7 @@ from .group_by import GroupBy
|
|
17
17
|
|
18
18
|
if TYPE_CHECKING:
|
19
19
|
from collections.abc import Callable, Iterator
|
20
|
+
from re import Pattern, _FlagsType
|
20
21
|
from typing import Any, Self
|
21
22
|
|
22
23
|
from numpy.typing import NDArray
|
@@ -807,9 +808,10 @@ class Collection[I](Sequence[I]):
|
|
807
808
|
def match(
|
808
809
|
self,
|
809
810
|
key: str,
|
810
|
-
pattern: str |
|
811
|
+
pattern: str | Pattern[str],
|
811
812
|
*,
|
812
813
|
default: Any | Callable[[I], Any] = MISSING,
|
814
|
+
flags: _FlagsType = 0,
|
813
815
|
) -> Callable[[I], bool]:
|
814
816
|
"""Create a predicate function that checks if an attribute matches a pattern.
|
815
817
|
|
@@ -817,12 +819,16 @@ class Collection[I](Sequence[I]):
|
|
817
819
|
key (str): The name of the attribute to check.
|
818
820
|
pattern (str | re.Pattern): The pattern to check for.
|
819
821
|
default (Any | Callable[[I], Any], optional): The default value.
|
822
|
+
flags (re.RegexFlag, optional): Flags for the regex pattern.
|
820
823
|
|
821
824
|
Returns:
|
822
825
|
Callable[[I], bool]: A predicate function for filtering.
|
823
826
|
|
824
827
|
"""
|
825
|
-
return
|
828
|
+
return (
|
829
|
+
lambda i: re.match(pattern, str(self._get(i, key, default)), flags)
|
830
|
+
is not None
|
831
|
+
)
|
826
832
|
|
827
833
|
|
828
834
|
def to_hashable(value: Any) -> Hashable:
|
hydraflow/core/run.py
CHANGED
@@ -40,7 +40,7 @@ if TYPE_CHECKING:
|
|
40
40
|
from collections.abc import Iterator
|
41
41
|
from typing import Any, Self
|
42
42
|
|
43
|
-
from polars import Expr
|
43
|
+
from polars import DataFrame, Expr
|
44
44
|
from polars._typing import PolarsDataType
|
45
45
|
|
46
46
|
from .run_collection import RunCollection
|
@@ -341,6 +341,27 @@ class Run[C, I = None]:
|
|
341
341
|
value = self.get(key, default)
|
342
342
|
return pl.lit(value, dtype).alias(key)
|
343
343
|
|
344
|
+
def to_frame(
|
345
|
+
self,
|
346
|
+
func: Callable[[Self], DataFrame],
|
347
|
+
*keys: str | tuple[str, Any | Callable[[Self], Any]],
|
348
|
+
) -> DataFrame:
|
349
|
+
"""Convert the Run to a DataFrame.
|
350
|
+
|
351
|
+
Args:
|
352
|
+
func (Callable[[Run], DataFrame]): A function that takes a Run
|
353
|
+
instance and returns a DataFrame.
|
354
|
+
keys (str | tuple[str, Any | Callable[[Run], Any]]): The keys to
|
355
|
+
add to the DataFrame.
|
356
|
+
|
357
|
+
Returns:
|
358
|
+
DataFrame: A DataFrame representation of the Run.
|
359
|
+
|
360
|
+
"""
|
361
|
+
return func(self).with_columns(
|
362
|
+
self.lit(k) if isinstance(k, str) else self.lit(k[0], k[1]) for k in keys
|
363
|
+
)
|
364
|
+
|
344
365
|
def to_dict(self, flatten: bool = True) -> dict[str, Any]:
|
345
366
|
"""Convert the Run to a dictionary.
|
346
367
|
|
hydraflow/core/run_collection.py
CHANGED
@@ -43,6 +43,8 @@ from __future__ import annotations
|
|
43
43
|
from functools import cached_property
|
44
44
|
from typing import TYPE_CHECKING, overload
|
45
45
|
|
46
|
+
import polars as pl
|
47
|
+
|
46
48
|
from .collection import Collection
|
47
49
|
from .run import Run
|
48
50
|
|
@@ -51,6 +53,8 @@ if TYPE_CHECKING:
|
|
51
53
|
from pathlib import Path
|
52
54
|
from typing import Any, Self
|
53
55
|
|
56
|
+
from polars import DataFrame
|
57
|
+
|
54
58
|
|
55
59
|
class RunCollection[R: Run[Any, Any], I = None](Collection[R]):
|
56
60
|
"""A collection of Run instances that implements the Sequence protocol.
|
@@ -168,6 +172,28 @@ class RunCollection[R: Run[Any, Any], I = None](Collection[R]):
|
|
168
172
|
for run in self:
|
169
173
|
run.update(key, value, force=force)
|
170
174
|
|
175
|
+
def concat(
|
176
|
+
self,
|
177
|
+
func: Callable[[R], DataFrame],
|
178
|
+
*keys: str | tuple[str, Any | Callable[[R], Any]],
|
179
|
+
) -> DataFrame:
|
180
|
+
"""Concatenate the results of a function applied to all runs in the collection.
|
181
|
+
|
182
|
+
This method applies the provided function to each run in the collection
|
183
|
+
and concatenates the resulting DataFrames along the specified keys.
|
184
|
+
|
185
|
+
Args:
|
186
|
+
func (Callable[[R], DataFrame]): A function that takes a Run
|
187
|
+
instance and returns a DataFrame.
|
188
|
+
keys (str | tuple[str, Any | Callable[[R], Any]]): The keys to
|
189
|
+
add to the DataFrame.
|
190
|
+
|
191
|
+
Returns:
|
192
|
+
DataFrame: A DataFrame representation of the Run.
|
193
|
+
|
194
|
+
"""
|
195
|
+
return pl.concat(run.to_frame(func, *keys) for run in self)
|
196
|
+
|
171
197
|
@cached_property
|
172
198
|
def impls(self) -> Collection[I]:
|
173
199
|
"""Get the implementation objects for all runs in the collection.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hydraflow
|
3
|
-
Version: 0.18.
|
3
|
+
Version: 0.18.3
|
4
4
|
Summary: HydraFlow seamlessly integrates Hydra and MLflow to streamline ML experiment management, combining Hydra's configuration management with MLflow's tracking capabilities.
|
5
5
|
Project-URL: Documentation, https://daizutabi.github.io/hydraflow/
|
6
6
|
Project-URL: Source, https://github.com/daizutabi/hydraflow
|
@@ -2,13 +2,13 @@ hydraflow/__init__.py,sha256=_cLLokEv0pUlwvG8RMnjOwCTtDQBs0-RgGbtDk5m_Xg,794
|
|
2
2
|
hydraflow/cli.py,sha256=3rGr___wwp8KazjLGQ7JO_IgAMqLyMlcVSs_QJK7g0Y,3135
|
3
3
|
hydraflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
hydraflow/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
hydraflow/core/collection.py,sha256=
|
5
|
+
hydraflow/core/collection.py,sha256=s1XtsV1AU5Cr6XutMfphRA60uhompDiQQVSgb_Xz-nM,30437
|
6
6
|
hydraflow/core/context.py,sha256=6vpwe0Xfl6mzh2hHLE-4uB9Hjew-CK4pA0KFihQ80U8,4168
|
7
7
|
hydraflow/core/group_by.py,sha256=Pnw-oA5aXHeRG9lMLz-bKc8drqQ8LIRsWzvVn153iyQ,5488
|
8
8
|
hydraflow/core/io.py,sha256=B3-jPuJWttRgpbIpy_XA-Z2qpXzNF1ATwyYEwA7Pv3w,5172
|
9
9
|
hydraflow/core/main.py,sha256=6X58M-xpJPql7xqLR3gpa4XMePvZ6Q1diMSqTZf2Jrw,6542
|
10
|
-
hydraflow/core/run.py,sha256=
|
11
|
-
hydraflow/core/run_collection.py,sha256=
|
10
|
+
hydraflow/core/run.py,sha256=QMPdQGTOJd45pVnSkLmnWv5mMRjnGKTRe-qW80q57RI,15730
|
11
|
+
hydraflow/core/run_collection.py,sha256=isyZblSWtXIDqxiLea6xkfQp7o5ip1KrrfaWqi4gtps,7621
|
12
12
|
hydraflow/core/run_info.py,sha256=SMOTZXEa7OBV_XjTyctk5gJGrggmYwhePvRF8CLF1kU,1616
|
13
13
|
hydraflow/executor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
hydraflow/executor/aio.py,sha256=xXsmBPIPdBlopv_1h0FdtOvoKUcuW7PQeKCV2d_lN9I,2122
|
@@ -18,8 +18,8 @@ hydraflow/executor/job.py,sha256=6QeJ18OMeocXeM04rCYL46GgArfX1SvZs9_4HTomTgE,543
|
|
18
18
|
hydraflow/executor/parser.py,sha256=RxP8qpDaJ8VLqZ51VlPFyVitWctObhkE_3iPIsY66Cs,14610
|
19
19
|
hydraflow/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
20
|
hydraflow/utils/progress.py,sha256=a-CHvioyGCeiUKawqPcV8i1nhzunm5-r5AlLbzd5epw,3048
|
21
|
-
hydraflow-0.18.
|
22
|
-
hydraflow-0.18.
|
23
|
-
hydraflow-0.18.
|
24
|
-
hydraflow-0.18.
|
25
|
-
hydraflow-0.18.
|
21
|
+
hydraflow-0.18.3.dist-info/METADATA,sha256=aDozL50IRZi_dIWcL1NwfZPWKN3jU3YLs-ihM7gmde0,7433
|
22
|
+
hydraflow-0.18.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
23
|
+
hydraflow-0.18.3.dist-info/entry_points.txt,sha256=XI0khPbpCIUo9UPqkNEpgh-kqK3Jy8T7L2VCWOdkbSM,48
|
24
|
+
hydraflow-0.18.3.dist-info/licenses/LICENSE,sha256=IGdDrBPqz1O0v_UwCW-NJlbX9Hy9b3uJ11t28y2srmY,1062
|
25
|
+
hydraflow-0.18.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|