scikit-learn-contrib / lightning

Large-scale linear classification, regression and ranking in Python
https://contrib.scikit-learn.org/lightning/
1.72k stars 214 forks source link

Using existing numpy RandomState #62

Open vene opened 8 years ago

vene commented 8 years ago

The _get_random_state implementation in base.py forces all estimators to only take integer seed values for the random_state attribute. I'd like the functionality to pass an existing RandomState object. This is useful when using lightning objects as part of other estimators.

Unfortunately I'm not sure if this is compatible with the randomkit backport here.

mblondel commented 8 years ago

Can we set the internal state of lightning's random state from numpy's?

BTW, oiriginally I added the randomkit backport so that we can use randint in tight loops. However, this can also be achieved by generating a random array before the loop. So, with a bit of work, we could possibly remove the randomkit if necessary.

vene commented 8 years ago

I guess we should add this set_state to the backport. I will try it out.