ContinuousIntervalTree#
- class ContinuousIntervalTree(max_depth=9223372036854775807, thresholds=20, random_state=None)[source]#
连续区间树(CIT)向量分类器(也称为时间序列树)。
时间序列森林(TSF)论文 Deng 等人(2013)[1] 中描述的
时间序列树
。一种简单的基于信息增益的树,用于连续属性,使用定制的边缘增益指标进行平局打破。作为基于区间的时序分类器(如
CanonicalIntervalForest
和DrCIF
)的基础分类器实现。- 参数:
- max_depthint, 默认值=sys.maxsize
树的最大深度。
- thresholdsint, 默认值=20
在树节点上分割连续属性的阈值数量。
- random_stateint, RandomState 实例或 None, 默认值=None
如果为
int
,则 random_state 是随机数生成器使用的种子;如果为RandomState
实例,则 random_state 是随机数生成器;如果为None
,则随机数生成器是np.random
使用的RandomState
实例。
- 属性:
- classes_list
训练集中的唯一类别标签。
- n_classes_int
训练集中的唯一类别数量。
- n_instances_int
训练集中的训练案例数量。
- n_atts_int
训练集中的属性数量。
另请参阅
规范区间森林
DrCIF
注意
对于 Java 版本,请参阅 tsml。
参考文献
[1]H.Deng, G.Runger, E.Tuv and M.Vladimir, “A time series forest for classification and feature extraction”,Information Sciences, 239, 2013
示例
>>> from sktime.classification.sklearn import ContinuousIntervalTree >>> from sktime.datasets import load_unit_test >>> from sktime.datatypes._panel._convert import from_nested_to_3d_numpy >>> X_train, y_train = load_unit_test(split="train", return_X_y=True) >>> X_test, y_test = load_unit_test(split="test", return_X_y=True) >>> X_train = from_nested_to_3d_numpy(X_train) >>> X_test = from_nested_to_3d_numpy(X_test) >>> clf = ContinuousIntervalTree() >>> clf.fit(X_train, y_train) ContinuousIntervalTree(...) >>> y_pred = clf.predict(X_test)
方法
fit
(X, y)在案例 (X,y) 上拟合树,其中 y 是目标变量。
获取此对象的元数据路由。
get_params
([deep])获取此评估器的参数。
predict
(X)预测 X 中的所有案例。
预测 X 中所有案例的每个类别的概率估计。
set_params
(**params)设置此评估器的参数。
递归查找每个树节点的分割和信息增益。
- fit(X, y)[source]#
在案例 (X,y) 上拟合树,其中 y 是目标变量。
使用边缘增益指标处理平局,为连续属性构建一个基于信息增益的树。
- 参数:
- X形状为 [n_instances, n_attributes] 的二维 ndarray 或 DataFrame
训练数据。
- yarray-like, 形状为 [n_instances]
类别标签。
- 返回:
- self
对 self 的引用。
注意
通过创建一个已拟合模型来改变状态,该模型更新以“_”结尾的属性。
- predict(X)[source]#
预测 X 中的所有案例。构建在 predict_proba 之上。
- 参数:
- X形状为 [n_instances, n_attributes] 的二维 ndarray 或 DataFrame
用于进行预测的数据。
- 返回:
- yarray-like, 形状为 [n_instances]
预测的类别标签。
- predict_proba(X)[source]#
预测 X 中所有案例的每个类别的概率估计。
- 参数:
- X形状为 [n_instances, n_attributes] 的二维 ndarray 或 DataFrame
用于进行预测的数据。
- 返回:
- yarray-like, 形状为 [n_instances, n_classes_]
使用 classes_ 中的顺序预测的概率。
- get_metadata_routing()[source]#
获取此对象的元数据路由。
请查看 用户指南 了解路由机制的工作原理。
- 返回:
- routingMetadataRequest
一个封装路由信息的
MetadataRequest
。