mirror of
https://github.com/Doctorado-ML/bayesclass.git
synced 2025-08-17 16:45:54 +00:00
fix: 🐛 Fix depth_ property as an alias of states_
This commit is contained in:
@@ -21,7 +21,6 @@ class BayesBase(BaseEstimator, ClassifierMixin):
|
|||||||
self.show_progress = show_progress
|
self.show_progress = show_progress
|
||||||
# To keep compatiblity with the benchmark platform
|
# To keep compatiblity with the benchmark platform
|
||||||
self.nodes_leaves = self.nodes_edges
|
self.nodes_leaves = self.nodes_edges
|
||||||
self.depth_ = self.states_
|
|
||||||
|
|
||||||
def _more_tags(self):
|
def _more_tags(self):
|
||||||
return {
|
return {
|
||||||
@@ -71,6 +70,10 @@ class BayesBase(BaseEstimator, ClassifierMixin):
|
|||||||
return sum([len(item) for _, item in self.model_.states.items()])
|
return sum([len(item) for _, item in self.model_.states.items()])
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@property
|
||||||
|
def depth_(self):
|
||||||
|
return self.states_
|
||||||
|
|
||||||
def fit(self, X, y, **kwargs):
|
def fit(self, X, y, **kwargs):
|
||||||
"""A reference implementation of a fitting function for a classifier.
|
"""A reference implementation of a fitting function for a classifier.
|
||||||
|
|
||||||
|
@@ -66,6 +66,7 @@ def test_AODE_states(clf, data):
|
|||||||
clf = AODE(random_state=17)
|
clf = AODE(random_state=17)
|
||||||
clf.fit(*data)
|
clf.fit(*data)
|
||||||
assert clf.states_ == 23
|
assert clf.states_ == 23
|
||||||
|
assert clf.depth_ == clf.states_
|
||||||
|
|
||||||
|
|
||||||
def test_AODE_classifier(data, clf):
|
def test_AODE_classifier(data, clf):
|
||||||
|
@@ -58,6 +58,7 @@ def test_KDB_states(clf, data):
|
|||||||
clf = KDB(k=3, random_state=17)
|
clf = KDB(k=3, random_state=17)
|
||||||
clf.fit(*data)
|
clf.fit(*data)
|
||||||
assert clf.states_ == 23
|
assert clf.states_ == 23
|
||||||
|
assert clf.depth_ == clf.states_
|
||||||
|
|
||||||
|
|
||||||
def test_KDB_classifier(data, clf):
|
def test_KDB_classifier(data, clf):
|
||||||
|
@@ -57,6 +57,7 @@ def test_TAN_states(clf, data):
|
|||||||
clf = TAN(random_state=17)
|
clf = TAN(random_state=17)
|
||||||
clf.fit(*data)
|
clf.fit(*data)
|
||||||
assert clf.states_ == 23
|
assert clf.states_ == 23
|
||||||
|
assert clf.depth_ == clf.states_
|
||||||
|
|
||||||
|
|
||||||
def test_TAN_random_head(data):
|
def test_TAN_random_head(data):
|
||||||
|
Reference in New Issue
Block a user