Skip to content

Commit

Permalink
[ENH] Remove BaseClassifier unnecessary declarations (#1887)
Browse files Browse the repository at this point in the history
* remove Theta

* remove duplicate declaration for _n_jobs and fit_time in BaseClassifier

* remove duplicate declaration for _n_jobs and fit_time in BaseClassifier
  • Loading branch information
TonyBagnall authored Aug 6, 2024
1 parent 6a3cc0e commit d1d9c72
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions aeon/classification/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,8 @@ class BaseClassifier(BaseCollectionEstimator, ABC):
Class labels, either integers or strings.
n_classes_ : int
Number of classes (length of ``classes_``).
fit_time_ : int
Time (in milliseconds) for ``fit`` to run.
_class_dictionary : dict
Mapping of classes_ onto integers ``0 ... n_classes_-1``.
_n_jobs : int
Number of threads to use in estimator methods such as ``fit`` and ``predict``.
Determined by the ``n_jobs`` parameter if present.
_estimator_type : string
The type of estimator. Required by some ``sklearn`` tools, set to "classifier".
"""
Expand All @@ -74,17 +69,10 @@ class BaseClassifier(BaseCollectionEstimator, ABC):
}

def __init__(self):
# reserved attributes written to in fit
self.classes_ = [] # classes seen in y, unique labels
self.n_classes_ = -1 # number of unique classes in y
self._class_dictionary = {}
self.fit_time_ = -1
self._n_jobs = 1

# required for compatibility with some sklearn interfaces e.g.
# CalibratedClassifierCV
self._estimator_type = "classifier"

super().__init__()
_check_estimator_deps(self)

Expand All @@ -105,7 +93,7 @@ def fit(self, X, y) -> BaseCollectionEstimator:
allowed and converted into one of the above.
Different estimators have different capabilities to handle different
types of input. If `self.get_tag("capability:multivariate")`` is False,
types of input. If ``self.get_tag("capability:multivariate")`` is False,
they cannot handle multivariate series, so either ``n_channels == 1`` is
true or X is 2D of shape ``(n_cases, n_timepoints)``. If ``self.get_tag(
"capability:unequal_length")`` is False, they cannot handle unequal
Expand Down Expand Up @@ -154,7 +142,7 @@ def predict(self, X) -> np.ndarray:
other types are allowed and converted into one of the above.
Different estimators have different capabilities to handle different
types of input. If `self.get_tag("capability:multivariate")`` is False,
types of input. If ``self.get_tag("capability:multivariate")`` is False,
they cannot handle multivariate series, so either ``n_channels == 1`` is
true or X is 2D of shape ``(n_cases, n_timepoints)``. If ``self.get_tag(
"capability:unequal_length")`` is False, they cannot handle unequal
Expand Down Expand Up @@ -197,7 +185,7 @@ def predict_proba(self, X) -> np.ndarray:
allowed and converted into one of the above.
Different estimators have different capabilities to handle different
types of input. If `self.get_tag("capability:multivariate")`` is False,
types of input. If ``self.get_tag("capability:multivariate")`` is False,
they cannot handle multivariate series, so either ``n_channels == 1`` is
true or X is 2D of shape ``(n_cases, n_timepoints)``. If ``self.get_tag(
"capability:unequal_length")`` is False, they cannot handle unequal
Expand Down Expand Up @@ -252,7 +240,7 @@ def fit_predict(self, X, y, **kwargs) -> np.ndarray:
allowed and converted into one of the above.
Different estimators have different capabilities to handle different
types of input. If `self.get_tag("capability:multivariate")`` is False,
types of input. If ``self.get_tag("capability:multivariate")`` is False,
they cannot handle multivariate series, so either ``n_channels == 1`` is
true or X is 2D of shape ``(n_cases, n_timepoints)``. If ``self.get_tag(
"capability:unequal_length")`` is False, they cannot handle unequal
Expand Down Expand Up @@ -318,7 +306,7 @@ def fit_predict_proba(self, X, y, **kwargs) -> np.ndarray:
allowed and converted into one of the above.
Different estimators have different capabilities to handle different
types of input. If `self.get_tag("capability:multivariate")`` is False,
types of input. If ``self.get_tag("capability:multivariate")`` is False,
they cannot handle multivariate series, so either ``n_channels == 1`` is
true or X is 2D of shape ``(n_cases, n_timepoints)``. If ``self.get_tag(
"capability:unequal_length")`` is False, they cannot handle unequal
Expand Down Expand Up @@ -376,7 +364,7 @@ def score(
allowed and converted into one of the above.
Different estimators have different capabilities to handle different
types of input. If `self.get_tag("capability:multivariate")`` is False,
types of input. If ``self.get_tag("capability:multivariate")`` is False,
they cannot handle multivariate series, so either ``n_channels == 1`` is
true or X is 2D of shape ``(n_cases, n_timepoints)``. If ``self.get_tag(
"capability:unequal_length")`` is False, they cannot handle unequal
Expand Down

0 comments on commit d1d9c72

Please sign in to comment.