fix: 🐛 Fix depth_ property as an alias of states_

This commit is contained in:
Ricardo Montañana Gómez
2023-01-22 14:15:19 +01:00
parent bdd3f483d9
commit 4d416959ad
4 changed files with 7 additions and 1 deletions

View File

@@ -21,7 +21,6 @@ class BayesBase(BaseEstimator, ClassifierMixin):
self.show_progress = show_progress
# To keep compatiblity with the benchmark platform
self.nodes_leaves = self.nodes_edges
self.depth_ = self.states_
def _more_tags(self):
return {
@@ -71,6 +70,10 @@ class BayesBase(BaseEstimator, ClassifierMixin):
return sum([len(item) for _, item in self.model_.states.items()])
return 0
@property
def depth_(self):
return self.states_
def fit(self, X, y, **kwargs):
"""A reference implementation of a fitting function for a classifier.

View File

@@ -66,6 +66,7 @@ def test_AODE_states(clf, data):
clf = AODE(random_state=17)
clf.fit(*data)
assert clf.states_ == 23
assert clf.depth_ == clf.states_
def test_AODE_classifier(data, clf):

View File

@@ -58,6 +58,7 @@ def test_KDB_states(clf, data):
clf = KDB(k=3, random_state=17)
clf.fit(*data)
assert clf.states_ == 23
assert clf.depth_ == clf.states_
def test_KDB_classifier(data, clf):

View File

@@ -57,6 +57,7 @@ def test_TAN_states(clf, data):
clf = TAN(random_state=17)
clf.fit(*data)
assert clf.states_ == 23
assert clf.depth_ == clf.states_
def test_TAN_random_head(data):