Skip to content
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
12 changes: 6 additions & 6 deletions reco_utils/tuning/nni/ncf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@


def compute_test_results(model, train, test, rating_metrics, ranking_metrics):
"""Compute the test results using a trained NCF model.
"""Compute the test results using a trained NCF model.

Args:
model (obj): TF model.
model (obj): TF model.
train (pd.DataFrame): Train set.
test (pd.DataFrame): Test set.
rating_metrics (list): List of rating metrics.
ranking_metrics (list): List of ranking metrics.

Returns:
dict: Test results.
dict: Test results.

"""
test_results = {}
Expand Down Expand Up @@ -51,13 +51,13 @@ def compute_test_results(model, train, test, rating_metrics, ranking_metrics):


def combine_metrics_dicts(*metrics):
"""Combine metrics from dicts.
"""Combine metrics from dicts.

Args:
metrics (dict): Metrics
metrics (dict): Metrics

Returns:
pd.DataFrame: Dataframe with metrics combined.
pd.DataFrame: Dataframe with metrics combined.
"""
df = pd.DataFrame(metrics[0], index=[0])
for metric in metrics[1:]:
Expand Down
5 changes: 3 additions & 2 deletions tests/unit/test_nni_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,14 @@ def test_check_metrics_written_timeout():
@pytest.mark.skipif(sys.platform == "win32", reason="nni not installable on windows")
def test_get_trials():
with TemporaryDirectory() as tmp_dir1, TemporaryDirectory() as tmp_dir2:

mock_trials = [
{
"finalMetricData": [{"data": '{"rmse":0.8,"default":0.3}'}],
"finalMetricData":[{"data":"\"{\\\"rmse\\\": 0.8, \\\"default\\\": 0.3}\""}],
"logPath": "file://localhost:{}".format(tmp_dir1),
},
{
"finalMetricData": [{"data": '{"rmse":0.9,"default":0.2}'}],
"finalMetricData":[{"data":"\"{\\\"rmse\\\": 0.9, \\\"default\\\": 0.2}\""}],
"logPath": "file://localhost:{}".format(tmp_dir2),
},
]
Expand Down