def __init__(self, n_estimators=100, tie_break=1, default_label=0, random_state=None):
"""Sets up the MDR ensemble
Parameters
----------
n_estimators: int (default: 100)
Number of MDR models to include in the ensemble
tie_break: int (default: 1)
Default label in case there's a tie in a set of feature pair values
default_label: int (default: 0)
Default label in case there's no data for a set of feature pair values
random_state: int, RandomState instance or None (default: None)
If int, random_state is the seed used by the random number generator;
If RandomState instance, random_state is the random number generator;
If None, the random number generator is the RandomState instance used by np.random.
Returns
-------
None
"""
self.n_estimators = n_estimators
self.tie_break = tie_break
self.default_label = default_label
self.random_state = random_state
self.feature_map = defaultdict(lambda: default_label)
self.ensemble = BaggingClassifier(base_estimator=MDR(tie_break=tie_break, default_label=default_label),
n_estimators=n_estimators, random_state=random_state)
评论列表
文章目录