Skip to content

Warn about random_state usage across NDM classes#37

Open
Luca-W-D wants to merge 4 commits intonoise-lab:masterfrom
Luca-W-D:random-state-warnings
Open

Warn about random_state usage across NDM classes#37
Luca-W-D wants to merge 4 commits intonoise-lab:masterfrom
Luca-W-D:random-state-warnings

Conversation

@Luca-W-D
Copy link

Many NDM models expose a random_state parameter, but its behavior varies because different models rely on different underlying libraries (scikit-learn, PyOD, PyTorch). As a result, some models produce deterministic output while others ignore the argument entirely. This is also confusing when users pass a model instance to create a MODEL object, which has its own random_state parameter with no effect.

Changes included:

  • Added warnings (shown when verbose > 5) when random_state is passed but the relevant class doesn't use the parameter.
  • Preserved backward compatibility by continuing to accept random_state via kwargs.
  • Removed random_state from signatures where it is nonfunctional.

I also made some arbitrary decisions to try and match the current repository:

  • I chose verbose > 5 as the threshold, mimicking the AutoEncoder threshold for debug output; however, other parts of the repo use different cutoffs
  • I added verbose to PCA's function signature with a default value of 0. Other initializers default to verbose=False or verbose=1.

Hopefully these updates make reproducibility expectations clearer without breaking anyone's existing projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments