Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes FnConfig.make to FnConfig.make_lazy_fn to be more explicit. #473

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ml_metrics/_src/aggregates/classification_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ def test_fn_config_to_lazy_fn_by_module(self):
metrics=("recall", "precision"),
input_type="multiclass-multioutput",
),
).make()
).make_lazy_fn()
)
self.assertEqual(
classification.SamplewiseClassification( # pytype: disable=wrong-arg-types
Expand Down
2 changes: 1 addition & 1 deletion ml_metrics/_src/aggregates/retrieval_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def test_fn_config_to_lazy_fn_by_module(self):
fn="TopKRetrieval",
module="ml_metrics._src.aggregates.retrieval",
kwargs=dict(metrics=("recall", "precision")),
).make()
).make_lazy_fn()
)
self.assertEqual(
retrieval.TopKRetrieval(metrics=("recall", "precision")), # pytype: disable=wrong-arg-types
Expand Down
2 changes: 1 addition & 1 deletion ml_metrics/_src/chainables/lazy_fns.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class FnConfig:
def from_json_str(cls, json_str: str):
return cls(**json.loads(json_str))

def make(self):
def make_lazy_fn(self):
if self.module:
actual_fn = getattr(importlib.import_module(self.module), self.fn)
else:
Expand Down
4 changes: 3 additions & 1 deletion ml_metrics/_src/chainables/lazy_fns_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@ def test_external_makeable(self):
def test_fn_config_to_lazy_fn_direct(self):
self.assertEqual(
2,
lazy_fns.maybe_make(lazy_fns.FnConfig(fn='len', args=[[1, 2]]).make()),
lazy_fns.maybe_make(
lazy_fns.FnConfig(fn='len', args=[[1, 2]]).make_lazy_fn()
),
)

def test_makeable_lazy_fn(self):
Expand Down