ContinuousIntervalTree¶
- class ContinuousIntervalTree(max_depth: int = 9223372036854775807, thresholds: int = 20, random_state: int | Type[RandomState] | None = None)[source]¶
Continuous interval tree (CIT) vector classifier (aka Time Series Tree).
The Time Series Tree described in the Time Series Forest (TSF) [1]. A simple information gain based tree for continuous attributes using a bespoke margin gain metric for tie breaking.
Implemented as a bade classifier for interval based time series classifiers such as CanonicalIntervalForest and DrCIF.
- Parameters:
- max_depthint, default=sys.maxsize
Maximum depth for the tree.
- thresholdsint, default=20
Number of thresholds to split continous attributes on at tree nodes.
- random_stateint, 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.
- Attributes:
- classes_list
The unique class labels in the training set.
- n_classes_int
The number of unique classes in the training set.
- n_cases_int
The number of train cases in the training set.
- n_atts_int
The number of attributes in the training set.
See also
CanonicalIntervalForest
DrCIF
Notes
For the Java version, see tsml.
References
[1]H.Deng, G.Runger, E.Tuv and M.Vladimir, “A time series forest for classification and feature extraction”,Information Sciences, 239, 2013
Examples
>>> from aeon.classification.sklearn import ContinuousIntervalTree >>> from aeon.datasets import load_unit_test >>> X_train, y_train = load_unit_test(split="train") >>> X_test, y_test = load_unit_test(split="test") >>> clf = ContinuousIntervalTree() >>> clf.fit(X_train, y_train) ContinuousIntervalTree(...) >>> y_pred = clf.predict(X_test)
Methods
fit
(X, y)Fit a tree on cases (X,y), where y is the target variable.
Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
predict
(X)Predict for all cases in X.
Probability estimates for each class for all cases in X.
set_params
(**params)Set the parameters of this estimator.
Recursively find the split and information gain for each tree node.
- fit(X, y)[source]¶
Fit a tree on cases (X,y), where y is the target variable.
Build an information gain based tree for continuous attributes using the margin gain metric for ties.
- Parameters:
- X2d ndarray or DataFrame of shape = [n_cases, n_attributes]
The training data.
- yarray-like, shape = [n_cases]
The class labels.
- Returns:
- self
Reference to self.
Notes
Changes state by creating a fitted model that updates attributes ending in “_”.
- predict(X)[source]¶
Predict for all cases in X. Built on top of predict_proba.
- Parameters:
- X2d ndarray or DataFrame of shape = [n_cases, n_attributes]
The data to make predictions for.
- Returns:
- yarray-like, shape = [n_cases]
Predicted class labels.
- predict_proba(X)[source]¶
Probability estimates for each class for all cases in X.
- Parameters:
- X2d ndarray or DataFrame of shape = [n_cases, n_attributes]
The data to make predictions for.
- Returns:
- yarray-like, shape = [n_cases, n_classes_]
Predicted probabilities using the ordering in classes_.
- tree_node_splits_and_gain() Tuple[List[int], List[float]] [source]¶
Recursively find the split and information gain for each tree node.
- get_metadata_routing()[source]¶
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
- routingMetadataRequest
A
MetadataRequest
encapsulating routing information.
- get_params(deep=True)[source]¶
Get parameters for this estimator.
- Parameters:
- deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns:
- paramsdict
Parameter names mapped to their values.
- set_params(**params)[source]¶
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline
). The latter have parameters of the form<component>__<parameter>
so that it’s possible to update each component of a nested object.- Parameters:
- **paramsdict
Estimator parameters.
- Returns:
- selfestimator instance
Estimator instance.