Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_params(self, deep=True):
"""Return estimator parameter names for GridSearch support."""
if not deep:
return super(EnsembleVoteClassifier, self).get_params(deep=False)
else:
out = self.named_clfs.copy()
for name, step in six.iteritems(self.named_clfs):
for key, value in six.iteritems(step.get_params(deep=True)):
out['%s__%s' % (name, key)] = value
for key, value in six.iteritems(super(EnsembleVoteClassifier,
self).get_params(deep=False)):
out['%s' % key] = value
return out
def get_params(self, deep=True):
"""Return estimator parameter names for GridSearch support."""
if not deep:
return super(EnsembleVoteClassifier, self).get_params(deep=False)
else:
out = self.named_clfs.copy()
for name, step in six.iteritems(self.named_clfs):
for key, value in six.iteritems(step.get_params(deep=True)):
out['%s__%s' % (name, key)] = value
for key, value in six.iteritems(super(EnsembleVoteClassifier,
self).get_params(deep=False)):
out['%s' % key] = value
return out
def _name_estimators(estimators):
"""Generate names for estimators."""
names = [type(estimator).__name__.lower() for estimator in estimators]
namecount = defaultdict(int)
for _, name in zip(estimators, names):
namecount[name] += 1
for k, v in list(six.iteritems(namecount)):
if v == 1:
del namecount[k]
for i in reversed(range(len(estimators))):
name = names[i]
if name in namecount:
names[i] += "-%d" % namecount[name]
namecount[name] -= 1
return list(zip(names, estimators))
def get_params(self, deep=True):
"""Return estimator parameter names for GridSearch support."""
if not deep:
return super(EnsembleVoteClassifier, self).get_params(deep=False)
else:
out = self.named_clfs.copy()
for name, step in six.iteritems(self.named_clfs):
for key, value in six.iteritems(step.get_params(deep=True)):
out['%s__%s' % (name, key)] = value
for key, value in six.iteritems(super(EnsembleVoteClassifier,
self).get_params(deep=False)):
out['%s' % key] = value
return out