From a4edc74e8daf9261a8e77f4920ff828fee11764f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana?= Date: Fri, 27 Jan 2023 12:34:34 +0100 Subject: [PATCH] Replace len(self.features_) by self.n_features_in_ --- bayesclass/clfs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bayesclass/clfs.py b/bayesclass/clfs.py index 7973691..563c83f 100644 --- a/bayesclass/clfs.py +++ b/bayesclass/clfs.py @@ -248,8 +248,8 @@ class TAN(BayesBase): expected_args = ["class_name", "features", "head", "state_names"] X, y = self._check_params_fit(X, y, expected_args, kwargs) if self.head_ == "random": - self.head_ = random.randint(0, len(self.features_) - 1) - if self.head_ is not None and self.head_ >= len(self.features_): + self.head_ = random.randint(0, self.n_features_in_ - 1) + if self.head_ is not None and self.head_ >= self.n_features_in_: raise ValueError("Head index out of range") return X, y @@ -398,7 +398,7 @@ class AODE(BayesBase, BaseEnsemble): self.models_ = [] class_edges = [(self.class_name_, f) for f in self.features_] states = dict(state_names=kwargs.pop("state_names", [])) - for idx in range(len(self.features_)): + for idx in range(self.n_features_in_): feature_edges = [ (self.features_[idx], f) for f in self.features_