Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Noel Dawe authored and Noel Dawe committed Apr 8, 2011
1 parent f641291 commit 12c577f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scikits/learn/ensemble/bagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def fit(self, X, Y, sample_weight = [], sample_fraction = .5, baggs = 10, **para
sample_fraction: fraction of X and Y randomly sampled
baggs: number of sampling/training iterations
"""
if not 0. < sample_fraction < 1:
if not 0 < sample_fraction < 1:
raise ValueError("You must specify sample_fraction between 0 and 1 (exclusive)")
if baggs < 2:
raise ValueError("baggs must be greater than 1")
Expand All @@ -25,7 +25,7 @@ def fit(self, X, Y, sample_weight = [], sample_fraction = .5, baggs = 10, **para
for bagg in xrange(baggs):
# weight a random subsample with 0
random_sample_weight = sample_weight * \
(np.random.random_sample(sample_weight.shape[0])>sample_fraction)
(np.random.random_sample(sample_weight.shape[0])<sample_fraction)
estimator = self.estimator(**self.params)
estimator.fit(X,Y,random_sample_weight,**params)
self.append(estimator)
Expand Down

0 comments on commit 12c577f

Please sign in to comment.