Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Commit

Permalink
Merge pull request #19 from dvro/master
Browse files Browse the repository at this point in the history
EnsembleStackClassifier accepting combiner as string
  • Loading branch information
dvro committed Oct 6, 2016
2 parents 997ffed + 27c3bde commit 6126215
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions brew/stacking/stacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,18 @@ class EnsembleStackClassifier(object):

def __init__(self, stack, combiner=None):
self.stack = stack
self.combiner = combiner
if combiner is None:
self.combiner = Combiner(rule='majority_vote')
self.combiner = Combiner(rule='mean')
elif isinstance(combiner, str):
if combiner == 'majority_vote':
raise ValueError('EnsembleStackClassifier '
'do not support majority_vote')
self.combiner = Combiner(rule=combiner)
elif isinstance(combiner, Combiner):
self.combiner = combiner
else:
raise ValueError('Invalid combiner!')


def fit(self, X, y):
self.stack.fit(X, y)
Expand Down

0 comments on commit 6126215

Please sign in to comment.