Skip to content

Commit 52fa854

Browse files
committed
add classify in timecho table mode ainode from 2091
1 parent 1a24c74 commit 52fa854

5 files changed

Lines changed: 320 additions & 4 deletions

File tree

123 KB
Loading

src/UserGuide/Master/Table/AI-capability/AINode_Upgrade_timecho.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ TimechoDB-AINode supports three major functions: model inference, model fine-tun
6565

6666
### 4.1 Model Inference
6767

68-
TimechoDB-AINode provides the following time series prediction capabilities:
68+
The AINode table model supports two major inference capabilities: time series prediction and time series classification.
69+
70+
#### 4.1.1 Time Series Prediction
71+
72+
The time series prediction capability provided by the AINode table model includes:
6973

7074
* **Univariate Prediction**: Supports prediction of a single target variable.
7175
* **Covariate Prediction**: Can simultaneously predict multiple target variables and supports introducing covariates in prediction to improve accuracy.
@@ -85,6 +89,7 @@ SELECT * FROM FORECAST(
8589
OUTPUT_INTERVAL,
8690
TIMECOL,
8791
PRESERVE_INPUT,
92+
AUTO_ADAPT, -- Boolean type, indicating whether adaptive mode is enabled.
8893
MODEL_OPTIONS]?
8994
)
9095
```
@@ -322,6 +327,77 @@ IoTDB:etth> INSERT INTO tab_real (time, target1, target2, cov1, cov2, cov3) VALU
322327
```
323328

324329

330+
#### 4.1.2 Time Series Classification
331+
332+
Time series classification is a critical capability beyond time series prediction, with extensive applications in industrial scenarios. Its typical paradigm is to input the recent sampling values of multiple measuring points, comprehensively judge the overall operating status of the equipment, and output a classification label for the current status. For example, it can be used for operating status classification of new energy battery pack equipment and other scenarios.
333+
334+
The AINode table model supports executing time series classification tasks by calling covariate classification models.
335+
336+
> Note: This feature is available starting from version V2.0.9.
337+
338+
1. **SQL Syntax**
339+
```sql
340+
SELECT * FROM CLASSIFY(
341+
MODEL_ID,
342+
INPUTS -- SQL to retrieve input variables
343+
[TIMECOL,
344+
MODEL_OPTIONS]?
345+
)
346+
```
347+
348+
* Parameter Description
349+
350+
| Parameter Name | Parameter Type | Parameter Attribute | Description | Required | Remarks |
351+
|----------------|----------------|---------------------|-------------|----------|---------|
352+
| model_id | Scalar Parameter | String | Unique identifier of the model used for classification | Yes | - |
353+
| inputs | Table Parameter | SET SEMANTIC | Input data to be classified. IoTDB will automatically sort the data in ascending chronological order before passing it to AINode. | Yes | Describes the input data to be classified via SQL; corresponding query errors will be thrown if the input SQL is invalid. |
354+
| timecol | Scalar Parameter | String, Default: `time` | Name of the time column | No | Must be a column of TIMESTAMP type present in the `inputs` result set; otherwise, an error will be thrown. |
355+
| model_options | Scalar Parameter | String, Default: Empty string | Model-related key-value pairs (e.g., whether input normalization is required). Different key-value pairs are separated by `;`. | No | Unsupported parameters for a specific model will be ignored without throwing errors. |
356+
357+
**Specifications**
358+
359+
* **Input Data Requirements**
360+
- Type Constraint: Only INT32, INT64, FLOAT, and DOUBLE data types are supported currently.
361+
- Row Count Constraint: Varies by model. Errors will be thrown if the row count is below the minimum or above the maximum required by the model.
362+
- Column Count Constraint**: Must include a time column. Univariate classification models support only one data column and will throw an error for multiple columns; multivariate classification models generally have no restrictions unless explicitly specified by the model itself.
363+
- Order Constraint: Multivariate zero-shot classification models generally have no order restrictions unless explicitly specified by the model itself.
364+
365+
* **Output Result**
366+
The returned result is a table composed of time series data classification results, and its schema depends on the specific implementation of the model.
367+
368+
2. **Usage Example**
369+
370+
Suppose a project has 10 time series variables with an input length of 192. The custom `mantis_custom` model is used as an example for time series classification inference.
371+
372+
* Model Registration
373+
```sql
374+
CREATE MODEL mantis_custom USING URI 'file:///path/to/mantis'
375+
```
376+
For detailed steps to register a custom model, refer to Section 4.3.
377+
378+
* Execute SQL
379+
```sql
380+
IoTDB:etth> SELECT * FROM CLASSIFY (
381+
MODEL_ID => 'mantis_custom',
382+
INPUTS => (
383+
SELECT Time, HUFL,HULL,MUFL,MULL,LUFL,LULL,OT,UT,MT,LT
384+
FROM eg
385+
WHERE TIME < 2016-07-09 00:00:00
386+
ORDER BY TIME DESC
387+
LIMIT 192) ORDER BY TIME
388+
)
389+
```
390+
391+
* Execution Result
392+
```sql
393+
+--------+
394+
|category|
395+
+--------+
396+
| 4|
397+
+--------+
398+
```
399+
400+
325401
### 4.2 Model Fine-Tuning
326402

327403
AINode supports model fine-tuning through SQL.

src/UserGuide/latest-Table/AI-capability/AINode_Upgrade_timecho.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ TimechoDB-AINode supports three major functions: model inference, model fine-tun
6565

6666
### 4.1 Model Inference
6767

68-
TimechoDB-AINode provides the following time series prediction capabilities:
68+
The AINode table model supports two major inference capabilities: time series prediction and time series classification.
69+
70+
#### 4.1.1 Time Series Prediction
71+
72+
The time series prediction capability provided by the AINode table model includes:
6973

7074
* **Univariate Prediction**: Supports prediction of a single target variable.
7175
* **Covariate Prediction**: Can simultaneously predict multiple target variables and supports introducing covariates in prediction to improve accuracy.
@@ -85,6 +89,7 @@ SELECT * FROM FORECAST(
8589
OUTPUT_INTERVAL,
8690
TIMECOL,
8791
PRESERVE_INPUT,
92+
AUTO_ADAPT, -- Boolean type, indicating whether adaptive mode is enabled.
8893
MODEL_OPTIONS]?
8994
)
9095
```
@@ -322,6 +327,77 @@ IoTDB:etth> INSERT INTO tab_real (time, target1, target2, cov1, cov2, cov3) VALU
322327
```
323328

324329

330+
#### 4.1.2 Time Series Classification
331+
332+
Time series classification is a critical capability beyond time series prediction, with extensive applications in industrial scenarios. Its typical paradigm is to input the recent sampling values of multiple measuring points, comprehensively judge the overall operating status of the equipment, and output a classification label for the current status. For example, it can be used for operating status classification of new energy battery pack equipment and other scenarios.
333+
334+
The AINode table model supports executing time series classification tasks by calling covariate classification models.
335+
336+
> Note: This feature is available starting from version V2.0.9.
337+
338+
1. **SQL Syntax**
339+
```sql
340+
SELECT * FROM CLASSIFY(
341+
MODEL_ID,
342+
INPUTS -- SQL to retrieve input variables
343+
[TIMECOL,
344+
MODEL_OPTIONS]?
345+
)
346+
```
347+
348+
* Parameter Description
349+
350+
| Parameter Name | Parameter Type | Parameter Attribute | Description | Required | Remarks |
351+
|----------------|----------------|---------------------|-------------|----------|---------|
352+
| model_id | Scalar Parameter | String | Unique identifier of the model used for classification | Yes | - |
353+
| inputs | Table Parameter | SET SEMANTIC | Input data to be classified. IoTDB will automatically sort the data in ascending chronological order before passing it to AINode. | Yes | Describes the input data to be classified via SQL; corresponding query errors will be thrown if the input SQL is invalid. |
354+
| timecol | Scalar Parameter | String, Default: `time` | Name of the time column | No | Must be a column of TIMESTAMP type present in the `inputs` result set; otherwise, an error will be thrown. |
355+
| model_options | Scalar Parameter | String, Default: Empty string | Model-related key-value pairs (e.g., whether input normalization is required). Different key-value pairs are separated by `;`. | No | Unsupported parameters for a specific model will be ignored without throwing errors. |
356+
357+
**Specifications**
358+
359+
* **Input Data Requirements**
360+
- Type Constraint: Only INT32, INT64, FLOAT, and DOUBLE data types are supported currently.
361+
- Row Count Constraint: Varies by model. Errors will be thrown if the row count is below the minimum or above the maximum required by the model.
362+
- Column Count Constraint**: Must include a time column. Univariate classification models support only one data column and will throw an error for multiple columns; multivariate classification models generally have no restrictions unless explicitly specified by the model itself.
363+
- Order Constraint: Multivariate zero-shot classification models generally have no order restrictions unless explicitly specified by the model itself.
364+
365+
* **Output Result**
366+
The returned result is a table composed of time series data classification results, and its schema depends on the specific implementation of the model.
367+
368+
2. **Usage Example**
369+
370+
Suppose a project has 10 time series variables with an input length of 192. The custom `mantis_custom` model is used as an example for time series classification inference.
371+
372+
* Model Registration
373+
```sql
374+
CREATE MODEL mantis_custom USING URI 'file:///path/to/mantis'
375+
```
376+
For detailed steps to register a custom model, refer to Section 4.3.
377+
378+
* Execute SQL
379+
```sql
380+
IoTDB:etth> SELECT * FROM CLASSIFY (
381+
MODEL_ID => 'mantis_custom',
382+
INPUTS => (
383+
SELECT Time, HUFL,HULL,MUFL,MULL,LUFL,LULL,OT,UT,MT,LT
384+
FROM eg
385+
WHERE TIME < 2016-07-09 00:00:00
386+
ORDER BY TIME DESC
387+
LIMIT 192) ORDER BY TIME
388+
)
389+
```
390+
391+
* Execution Result
392+
```sql
393+
+--------+
394+
|category|
395+
+--------+
396+
| 4|
397+
+--------+
398+
```
399+
400+
325401
### 4.2 Model Fine-Tuning
326402

327403
AINode supports model fine-tuning through SQL.

src/zh/UserGuide/Master/Table/AI-capability/AINode_Upgrade_timecho.md

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ TimechoDB-AINode 支持模型推理、模型微调以及模型管理(注册、
6565

6666
### 4.1 模型推理
6767

68-
TimechoDB-AINode 表模型提供以下时序预测能力:
68+
TimechoDB-AINode 表模型支持时序预测和时序数据分类两大推理能力。
69+
70+
#### 4.1.1 时序预测
71+
72+
表模型 AINode 提供的时序预测能力包括:
6973

7074
* **单变量预测**:支持对单一目标变量进行预测。
7175
* **协变量预测**:可同时对多个目标变量进行联合预测,并支持在预测中引入协变量,以提升预测的准确性。
@@ -85,6 +89,7 @@ SELECT * FROM FORECAST(
8589
OUTPUT_INTERVAL,
8690
TIMECOL,
8791
PRESERVE_INPUT,
92+
AUTO_ADAPT, -- bool类型,表示是否开启自适应
8893
MODEL_OPTIONS]?
8994
)
9095
```
@@ -324,6 +329,83 @@ IoTDB:etth> INSERT INTO tab_real (time, target1, target2, cov1, cov2, cov3) VALU
324329
```
325330

326331

332+
#### 4.1.2 时序分类
333+
334+
时序分类是时序预测之外的重要能力,在工业界具有广泛应用。其典型范式是输入多个测点的近期采样值,综合判断设备整体运行状态,输出当前状态的分类标签。例如:可用于新能源电池组设备的运行状态分类等场景。
335+
336+
AINode 表模型支持通过调用协变量分类模型执行时序数据的分类任务。
337+
338+
> 注意:该功能从 V2.0.9 版本开始提供。
339+
340+
1. **SQL 语法**
341+
342+
```SQL
343+
SELECT * FROM CLASSIFY(
344+
MODEL_ID,
345+
INPUTS -- 获取输入变量的 SQL
346+
[TIMECOL,
347+
MODEL_OPTIONS]?
348+
)
349+
```
350+
351+
* 参数介绍
352+
353+
| 参数名 | 参数类型 | 参数属性 | 描述 | 是否必填 | 备注 |
354+
|-----------------|-------|-------------------| ----------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------ |
355+
| model\_id | 标量参数 | 字符串类型 | 分类所用模型的唯一标识| 是| |
356+
| inputs | 表参数 | SET SEMANTIC | 输入的待分类数据。IoTDB 会自动将数据按时间升序排序再交给 AINode 。 | 是 | 使用 SQL 描述输入的待分类数据,输入的 SQL 不合法时会有对应的查询报错。|
357+
| timecol | 标量参数 | 字符串类型,默认值:time | 时间列名| 否 | 存在于 inputs 中的,数据类型为 TIMESTAMP 的列,否则报错。 |
358+
| model\_options | 标量参数 | 字符串类型默认值:空字符串。 | 模型相关的 key-value 对,比如是否需要对输入进行归一化等。不同的 key-value 对以 ';' 间隔 | 否| 指定某个模型不支持参数,并不会报错,只会被忽略 |
359+
360+
说明:
361+
362+
***输入数据要求**​:
363+
* 类型约束:目前仅支持 INT32、INT64、FLOAT、DOUBLE 类型。
364+
* 行数要求:不同模型要求不同。对于有行数限制的模型,低于最小行数或高于最多行数时将报错。
365+
* 列数要求:必须包含时间列。单变量分类模型仅支持单列,多列将报错;多变量分类模型通常无限制,除非模型自身有明确约束。
366+
* 顺序要求:多变量零样本分类模型通常无限制,除非模型自身有明确约束。
367+
***输出结果**​:
368+
* 返回结果是由时序数据的分类结果组成的表,其规格取决于模型的具体实现。
369+
370+
2. **使用示例**
371+
372+
假设某项目的时序数据的变量数为10,输入长度为192。以自定义的 mantis\_custom 模型为例进行时序数据分类推理。
373+
374+
![](/img/ainode-classify-table-timecho.png)
375+
376+
* 注册模型
377+
378+
```SQL
379+
CREATE MODEL mantis_custom USING URI 'file:///path/to/mantis'
380+
```
381+
382+
注册自定义模型的详细步骤说明可参考 [4.3 小节](#_4-3-注册自定义模型)。
383+
384+
* 运行SQL
385+
386+
```SQL
387+
IoTDB:etth> SELECT * FROM CLASSIFY (
388+
MODEL_ID => 'mantis_custom',
389+
INPUTS => (
390+
SELECT Time, HUFL,HULL,MUFL,MULL,LUFL,LULL,OT,UT,MT,LT
391+
FROM eg
392+
WHERE TIME < 2016-07-09 00:00:00
393+
ORDER BY TIME DESC
394+
LIMIT 192) ORDER BY TIME
395+
)
396+
```
397+
398+
* 执行结果
399+
400+
```SQL
401+
+--------+
402+
|category|
403+
+--------+
404+
| 4|
405+
+--------+
406+
```
407+
408+
327409
### 4.2 模型微调
328410

329411
AINode 支持通过 SQL 进行模型微调任务。

0 commit comments

Comments
 (0)