Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
simonzhaoms committed May 23, 2022
1 parent 870cbe7 commit a179406
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/unit/recommenders/models/test_sar_singlenode.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,13 @@ def test_user_affinity(demo_usage_data, sar_settings, header):
**header
)
model.fit(demo_usage_data)
true_user_affinity = pd.read_csv(
sar_settings["FILE_DIR"] + "user_aff_2_months_later.csv"
).iloc[:, 1:]
true_user_affinity_url = sar_settings["FILE_DIR"] + "user_aff_2_months_later.csv"
true_user_affinity = pd.read_csv(true_user_affinity_url).iloc[:, 1:]
user_index = model.user2index[sar_settings["TEST_USER_ID"]]
item_indexes = pd.Series(model.item2index)[true_user_affinity.columns]
sar_user_affinity = model.user_affinity[user_index].toarray().flatten()[item_indexes]
assert np.allclose(
true_user_affinity.astype(sar_user_affinity.dtype),
sar_user_affinity,
atol=sar_settings["ATOL"],
)
true_user_affinity = true_user_affinity.astype(sar_user_affinity.dtype)
assert np.allclose(true_user_affinity, sar_user_affinity, atol=sar_settings["ATOL"])


@pytest.mark.parametrize(
Expand Down

0 comments on commit a179406

Please sign in to comment.