8000 Consider using integer random_state in IterativeImputer · Issue #15611 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
Consider using integer random_state in IterativeImputer #15611
@david-cortes

Description

@david-cortes

Lots of algorithms that rely on randomization offer an argument random_state through which it's possible to pass them RNG seeds that would ensure reproducible results. The IterativeImputer class will take some regressor/classifier and set their attribute random_state to a NumPy MT19937 object class if the object has such attribute, in such a way that this object is modified implicitly once the regressor/classifier to which it was assigned produces some random number.

This is fine for SciKit-Learn’s own classes, but other libraries which provide different regressors/classifiers which are SciKit-Learn-compatible (at least according to tests) might not be able to use such RandomState objects (e.g. if they generate random numbers in C++ with some method other than MT19937).

For example, XGBoost and LightGBM SciKit-Learn-compatible classes will only accept integers as parameters for their random_state, and there’s potentially many others too which will only accept integers.

Would be nice if IterativeImputer would instead generate a random integer seed to pass to the regressor/classifier at each iteration, so that it could be used with more external libraries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0