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

Set random seed in each lightfm test #1012

Merged
merged 2 commits into from
Mar 6, 2023
Merged
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
8 changes: 6 additions & 2 deletions tests/unit/lightfm/test_lightfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
from merlin.models.lightfm import LightFM
from merlin.schema import Tags

np.random.seed(0)


def test_warp():
np.random.seed(0)

train, valid = generate_data("music-streaming", 100, (0.95, 0.05))
train.schema = train.schema.remove_by_tag(Tags.TARGET)
valid.schema = valid.schema.remove_by_tag(Tags.TARGET)
Expand Down Expand Up @@ -55,6 +55,8 @@ def test_multiple_targets_raise_error():


def test_reload_no_target_column(tmpdir):
np.random.seed(0)

train, valid = generate_data("music-streaming", 100, (0.95, 0.05))
train.schema = train.schema.remove_by_tag(Tags.TARGET)
valid.schema = valid.schema.remove_by_tag(Tags.TARGET)
Expand All @@ -76,6 +78,8 @@ def test_reload_no_target_column(tmpdir):


def test_reload_with_target_column(tmpdir):
np.random.seed(0)

train, valid = generate_data("music-streaming", 100, (0.95, 0.05))
train.schema = train.schema.excluding_by_name(["play_percentage", "like"])
valid.schema = valid.schema.excluding_by_name(["play_percentage", "like"])
Expand Down