From 34c2904a95a707c6e6148480a7e2c86a0f7ad86b Mon Sep 17 00:00:00 2001
From: Andreas Mueller <amueller@ais.uni-bonn.de>
Date: Sun, 6 May 2012 20:20:05 +0200
Subject: [PATCH] FIX testing: random state problem in forest testing.

---
 sklearn/ensemble/tests/test_forest.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sklearn/ensemble/tests/test_forest.py b/sklearn/ensemble/tests/test_forest.py
index 0eabf44b48..0259c28927 100644
--- a/sklearn/ensemble/tests/test_forest.py
+++ b/sklearn/ensemble/tests/test_forest.py
@@ -188,7 +188,7 @@ def test_oob_score_classification():
     """Check that oob prediction is as acurate as
     usual prediction on the training set.
     Not really a good test that prediction is independent."""
-    clf = RandomForestClassifier(oob_score=True)
+    clf = RandomForestClassifier(oob_score=True, random_state=rng)
     clf.fit(X, y)
     training_score = clf.score(X, y)
     assert_almost_equal(training_score, clf.oob_score_)
@@ -197,7 +197,8 @@ def test_oob_score_classification():
 def test_oob_score_regression():
     """Check that oob prediction is pessimistic estimate.
     Not really a good test that prediction is independent."""
-    clf = RandomForestRegressor(n_estimators=50, oob_score=True)
+    clf = RandomForestRegressor(n_estimators=50, oob_score=True,
+            random_state=rng)
     n_samples = boston.data.shape[0]
     clf.fit(boston.data[:n_samples / 2, :], boston.target[:n_samples / 2])
     test_score = clf.score(boston.data[n_samples / 2:, :],
-- 
GitLab