ContinuousIntervalTree#

class ContinuousIntervalTree(max_depth=9223372036854775807, thresholds=20, random_state=None)[source]#

连续区间树(CIT)向量分类器(也称为时间序列树)。

时间序列森林(TSF)论文 Deng 等人(2013)[1] 中描述的时间序列树。一种简单的基于信息增益的树,用于连续属性,使用定制的边缘增益指标进行平局打破。

作为基于区间的时序分类器(如 CanonicalIntervalForestDrCIF)的基础分类器实现。

参数:
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_metadata_routing()

获取此对象的元数据路由。

get_params([deep])

获取此评估器的参数。

predict(X)

预测 X 中的所有案例。

predict_proba(X)

预测 X 中所有案例的每个类别的概率估计。

set_params(**params)

设置此评估器的参数。

tree_node_splits_and_gain()

递归查找每个树节点的分割和信息增益。

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_ 中的顺序预测的概率。

tree_node_splits_and_gain()[source]#

递归查找每个树节点的分割和信息增益。

get_metadata_routing()[source]#

获取此对象的元数据路由。

请查看 用户指南 了解路由机制的工作原理。

返回:
routingMetadataRequest

一个封装路由信息的 MetadataRequest

get_params(deep=True)[source]#

获取此评估器的参数。

参数:
deepbool, 默认值=True

如果为 True,将返回此评估器及其包含的作为评估器的子对象的参数。

返回:
paramsdict

参数名称映射到其值。

set_params(**params)[source]#

设置此评估器的参数。

此方法适用于简单的评估器以及嵌套对象(例如 Pipeline)。后者具有 <component>__<parameter> 形式的参数,以便可以更新嵌套对象的每个组件。

参数:
**paramsdict

评估器参数。

返回:
self评估器实例

评估器实例。