sklego/unseeded-random-estimator
| Rule | unseeded-random-estimator |
|---|---|
| Pack | scikit-lego |
| Severity | info |
| Fix | none, edit by hand |
| Library versions | every version |
RandomRegressor and RandomAdder without random_state draw new numbers on every call, so results change between calls. Pass random_state=.
baseline = RandomRegressor(strategy="normal")baseline = RandomRegressor(strategy="normal", random_state=0)What the rule reports
Section titled “What the rule reports”The rule reports RandomRegressor and RandomAdder built without random_state, outside test
files. Each call then draws new numbers.
How to fix it
Section titled “How to fix it”xpd has no automatic fix, so make the change by hand.
Two predict calls of one fitted RandomRegressor() differed, and so did two transform calls of
one RandomAdder() on its training rows. Both pairs were equal with random_state=0.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
$C without random_state draws new numbers on every call, so two calls on one fitted object gave different results. Pass random_state= to make the run repeatable.Browse the other rules of the scikit-lego pack.