From b8e8c5b77db0f283cb09cb763092de4c18bf0097 Mon Sep 17 00:00:00 2001 From: Leto_b Date: Mon, 27 Apr 2026 11:49:25 +0800 Subject: [PATCH] adjust number and style in ainode --- .../AI-capability/AINode_Upgrade_apache.md | 3 +- .../AI-capability/AINode_Upgrade_timecho.md | 73 +++++++++---------- .../AI-capability/AINode_Upgrade_apache.md | 14 ++-- .../AI-capability/AINode_Upgrade_timecho.md | 14 ++-- .../AI-capability/AINode_Upgrade_apache.md | 3 +- .../AI-capability/AINode_Upgrade_timecho.md | 63 ++++++++-------- .../AI-capability/AINode_Upgrade_apache.md | 14 ++-- .../AI-capability/AINode_Upgrade_timecho.md | 14 ++-- .../AI-capability/AINode_Upgrade_apache.md | 14 ++-- .../AI-capability/AINode_Upgrade_timecho.md | 49 ++++++------- .../AI-capability/AINode_Upgrade_apache.md | 14 ++-- .../AI-capability/AINode_Upgrade_timecho.md | 14 ++-- .../AI-capability/AINode_Upgrade_apache.md | 14 ++-- .../AI-capability/AINode_Upgrade_timecho.md | 49 ++++++------- .../AI-capability/AINode_Upgrade_apache.md | 14 ++-- .../AI-capability/AINode_Upgrade_timecho.md | 14 ++-- 16 files changed, 189 insertions(+), 191 deletions(-) diff --git a/src/UserGuide/Master/Table/AI-capability/AINode_Upgrade_apache.md b/src/UserGuide/Master/Table/AI-capability/AINode_Upgrade_apache.md index ddaac11b6..be7a0606b 100644 --- a/src/UserGuide/Master/Table/AI-capability/AINode_Upgrade_apache.md +++ b/src/UserGuide/Master/Table/AI-capability/AINode_Upgrade_apache.md @@ -163,8 +163,9 @@ It costs 1.615s 1. AINode uses Transformers v4.56.2; avoid inheriting interfaces from older versions (<4.50). 2. The model must inherit an AINode inference pipeline class (currently supports forecasting pipeline): + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py + ```python - # iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py class BasicPipeline(ABC): def __init__(self, model_id, **model_kwargs): self.model_info = model_info diff --git a/src/UserGuide/Master/Table/AI-capability/AINode_Upgrade_timecho.md b/src/UserGuide/Master/Table/AI-capability/AINode_Upgrade_timecho.md index 9e21bbe7f..e53c4d202 100644 --- a/src/UserGuide/Master/Table/AI-capability/AINode_Upgrade_timecho.md +++ b/src/UserGuide/Master/Table/AI-capability/AINode_Upgrade_timecho.md @@ -97,19 +97,19 @@ SELECT * FROM FORECAST( * Built-in model inference does not require a registration process. By using the forecast function and specifying model_id, you can use the inference function of the model. * Parameter description -| Parameter Name | Parameter Type | Parameter Attributes | Description | Required | Notes | -|----------------|----------------|----------------------|-------------|----------|-------| -| model_id | Scalar parameter | String type | Unique identifier of the prediction model | Yes | | -| targets | Table parameter | SET SEMANTIC | Input data for the target variables to be predicted. IoTDB will automatically sort the data in ascending order of time before passing it to AINode. | Yes | Use SQL to describe the input data with target variables. If the input SQL is invalid, corresponding query errors will be reported. | -| history_covs | Scalar parameter | String type (valid table model query SQL), default: none | Specifies historical data of covariates for this prediction task, which are used to assist in predicting target variables. AINode will not output prediction results for historical covariates. Before passing data to the model, AINode will automatically sort the data in ascending order of time. | No | 1. Query results can only contain FIELD columns; 2. Other: Different models may have specific requirements, and errors will be thrown if not met. | -| future_covs | Scalar parameter | String type (valid table model query SQL), default: none | Specifies future data of some covariates for this prediction task, which are used to assist in predicting target variables. Before passing data to the model, AINode will automatically sort the data in ascending order of time. | No | 1. Can only be specified when history_covs is set; 2. The covariate names involved must be a subset of history_covs; 3. Query results can only contain FIELD columns; 4. Other: Different models may have specific requirements, and errors will be thrown if not met. | -| auto_adapt | Scalar parameter | Boolean type, default value: true | Whether to enable adaptive processing for covariate inference.(Support from V2.0.8.2) | No | When adaptive mode is enabled: 1. If the set of future covariates (`future_covs`) is not a subset of the historical covariates (`history_covs`), any future covariates not present in the historical set will be automatically discarded. 2. If the length of any historical covariate does not match the length of the input target variable: a. If shorter, pad zeros at the beginning; b. If longer, discard the earliest data points. 3. If the length of any future covariate does not match the prediction length (`output_length`): a. If shorter, pad zeros at the end; b. If longer, discard the most recent data points. | -| output_start_time | Scalar parameter | Timestamp type. Default value: last timestamp of target variable + output_interval | Starting timestamp of output prediction points [i.e., forecast start time] | No | Must be greater than the maximum timestamp of target variable timestamps | -| output_length | Scalar parameter | INT32 type. Default value: 96 | Output window size | No | Must be greater than 0 | -| output_interval | Scalar parameter | Time interval type. Default value: (last timestamp - first timestamp of input data) / n - 1 | Time interval between output prediction points. Supported units: ns, us, ms, s, m, h, d, w | No | Must be greater than 0 | -| timecol | Scalar parameter | String type. Default value: time | Name of time column | No | Must be a TIMESTAMP column existing in targets | -| preserve_input | Scalar parameter | Boolean type. Default value: false | Whether to retain all original rows of target variable input in the output result set | No | | -| model_options | Scalar parameter | String type. Default value: empty string | Key-value pairs related to the model, such as whether to normalize the input. Different key-value pairs are separated by ';'. | No | | +| Parameter Name | Parameter Type | Parameter Attributes | Description | Required | Notes | +|----------------|----------------|----------------------|-------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| model_id | Scalar parameter | String type | Unique identifier of the prediction model | Yes | | +| targets | Table parameter | SET SEMANTIC | Input data for the target variables to be predicted. IoTDB will automatically sort the data in ascending order of time before passing it to AINode. | Yes | Use SQL to describe the input data with target variables. If the input SQL is invalid, corresponding query errors will be reported. | +| history_covs | Scalar parameter | String type (valid table model query SQL), default: none | Specifies historical data of covariates for this prediction task, which are used to assist in predicting target variables. AINode will not output prediction results for historical covariates. Before passing data to the model, AINode will automatically sort the data in ascending order of time. | No | 1. Query results can only contain FIELD columns;
2. Other: Different models may have specific requirements, and errors will be thrown if not met. | +| future_covs | Scalar parameter | String type (valid table model query SQL), default: none | Specifies future data of some covariates for this prediction task, which are used to assist in predicting target variables. Before passing data to the model, AINode will automatically sort the data in ascending order of time. | No | 1. Can only be specified when history_covs is set;
2. The covariate names involved must be a subset of history_covs;
3. Query results can only contain FIELD columns;
4. Other: Different models may have specific requirements, and errors will be thrown if not met. | +| auto_adapt | Scalar parameter | Boolean type, default value: true | Whether to enable adaptive processing for covariate inference.(Support from V2.0.8.2) | No | When adaptive mode is enabled:
1. If the set of future covariates (`future_covs`) is not a subset of the historical covariates (`history_covs`), any future covariates not present in the historical set will be automatically discarded.
2. If the length of any historical covariate does not match the length of the input target variable: a. If shorter, pad zeros at the beginning; b. If longer, discard the earliest data points.
3. If the length of any future covariate does not match the prediction length (`output_length`): a. If shorter, pad zeros at the end; b. If longer, discard the most recent data points. | +| output_start_time | Scalar parameter | Timestamp type. Default value: last timestamp of target variable + output_interval | Starting timestamp of output prediction points [i.e., forecast start time] | No | Must be greater than the maximum timestamp of target variable timestamps | +| output_length | Scalar parameter | INT32 type. Default value: 96 | Output window size | No | Must be greater than 0 | +| output_interval | Scalar parameter | Time interval type. Default value: (last timestamp - first timestamp of input data) / n - 1 | Time interval between output prediction points. Supported units: ns, us, ms, s, m, h, d, w | No | Must be greater than 0 | +| timecol | Scalar parameter | String type. Default value: time | Name of time column | No | Must be a TIMESTAMP column existing in targets | +| preserve_input | Scalar parameter | Boolean type. Default value: false | Whether to retain all original rows of target variable input in the output result set | No | | +| model_options | Scalar parameter | String type. Default value: empty string | Key-value pairs related to the model, such as whether to normalize the input. Different key-value pairs are separated by ';'. | No | | Notes: * **Default behavior**: Predict all columns of targets. Currently, only supports INT32, INT64, FLOAT, DOUBLE types. @@ -186,6 +186,17 @@ create table tab_real (target1 DOUBLE FIELD, target2 DOUBLE FIELD, cov1 DOUBLE F Prepare original data ```SQL +-- Insert statement +IoTDB:etth> INSERT INTO tab_real (time, target1, target2, cov1, cov2, cov3) VALUES +(1, 1.0, 1.0, 1.0, 1.0, 1.0), +(2, 2.0, 2.0, 2.0, 2.0, 2.0), +(3, 3.0, 3.0, 3.0, 3.0, 3.0), +(4, 4.0, 4.0, 4.0, 4.0, 4.0), +(5, 5.0, 5.0, 5.0, 5.0, 5.0), +(6, 6.0, 6.0, 6.0, 6.0, 6.0), +(7, NULL, NULL, NULL, NULL, 7.0), +(8, NULL, NULL, NULL, NULL, 8.0); + IoTDB:etth> SELECT * FROM tab_real +-----------------------------+-------+-------+----+----+----+ | time|target1|target2|cov1|cov2|cov3| @@ -199,18 +210,6 @@ IoTDB:etth> SELECT * FROM tab_real |1970-01-01T08:00:00.007+08:00| null| null|null|null| 7.0| |1970-01-01T08:00:00.008+08:00| null| null|null|null| 8.0| +-----------------------------+-------+-------+----+----+----+ - - --- Insert statement -IoTDB:etth> INSERT INTO tab_real (time, target1, target2, cov1, cov2, cov3) VALUES -(1, 1.0, 1.0, 1.0, 1.0, 1.0), -(2, 2.0, 2.0, 2.0, 2.0, 2.0), -(3, 3.0, 3.0, 3.0, 3.0, 3.0), -(4, 4.0, 4.0, 4.0, 4.0, 4.0), -(5, 5.0, 5.0, 5.0, 5.0, 5.0), -(6, 6.0, 6.0, 6.0, 6.0, 6.0), -(7, NULL, NULL, NULL, NULL, 7.0), -(8, NULL, NULL, NULL, NULL, 8.0); ``` * Prediction task 1: Use historical covariates cov1, cov2, and cov3 to assist in predicting target variables target1 and target2. @@ -363,13 +362,13 @@ SELECT * FROM CLASSIFY( **Specifications** * **Input Data Requirements** - - Type Constraint: Only INT32, INT64, FLOAT, and DOUBLE data types are supported currently. - - 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. - - 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. - - Order Constraint: Multivariate zero-shot classification models generally have no order restrictions unless explicitly specified by the model itself. + - Type Constraint: Only INT32, INT64, FLOAT, and DOUBLE data types are supported currently. + - 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. + - 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. + - Order Constraint: Multivariate zero-shot classification models generally have no order restrictions unless explicitly specified by the model itself. * **Output Result** -The returned result is a table composed of time series data classification results, and its schema depends on the specific implementation of the model. + The returned result is a table composed of time series data classification results, and its schema depends on the specific implementation of the model. 2. **Usage Example** @@ -486,7 +485,7 @@ IoTDB> show models 1. AINode currently uses transformers version 4.56.2, so when building the model, avoid inheriting interfaces from lower versions (<4.50); 2. The model must inherit a pipeline for inference tasks of AINode (currently supports prediction pipeline): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py ```Python class BasicPipeline(ABC): @@ -580,13 +579,13 @@ IoTDB> show models } ``` - 1. Must specify the Config class and model class through auto_map; - 2. Must integrate and specify the inference pipeline class; - 3. For built-in (builtin) and custom (user_defined) models managed by AINode, the model category (model_type) also serves as a unique identifier. That is, the model category to be registered must not duplicate any existing model types. Models created through fine-tuning will inherit the model category of the original model. + * Must specify the Config class and model class through auto_map; + * Must integrate and specify the inference pipeline class; + * For built-in (builtin) and custom (user_defined) models managed by AINode, the model category (model_type) also serves as a unique identifier. That is, the model category to be registered must not duplicate any existing model types. Models created through fine-tuning will inherit the model category of the original model. 4. Ensure the model directory to be registered contains the following files, and the model configuration file name and weight file name are not customizable: - 1. Model configuration file: config.json; - 2. Model weight file: model.safetensors; - 3. Model code: other .py files. + * Model configuration file: config.json; + * Model weight file: model.safetensors; + * Model code: other .py files. **The SQL syntax for registering custom models is as follows:** diff --git a/src/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_apache.md b/src/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_apache.md index 95120ae19..836c10fb4 100644 --- a/src/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_apache.md +++ b/src/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_apache.md @@ -137,7 +137,7 @@ Total line number = 48 1. AINode currently uses transformers v4.56.2, so when building the model, avoid inheriting from low versions (<4.50) interfaces; 2. The model must inherit from a type of AINode inference task pipeline (currently supports forecast pipeline): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py ```Python class BasicPipeline(ABC): @@ -231,13 +231,13 @@ Total line number = 48 } ``` - 1. Must specify the model's Config class and model class through auto_map; - 2. Must integrate and specify the inference pipeline class; - 3. For built-in (builtin) and user-defined (user_defined) models managed by AINode, the model category (model_type) also serves as a unique identifier. That is, the model category to be registered must not duplicate any existing model types. + * Must specify the model's Config class and model class through auto_map; + * Must integrate and specify the inference pipeline class; + * For built-in (builtin) and user-defined (user_defined) models managed by AINode, the model category (model_type) also serves as a unique identifier. That is, the model category to be registered must not duplicate any existing model types. 4. Ensure the model directory to be registered contains the following files, and the model configuration file name and weight file name are not customizable: - 1. Model configuration file: config.json; - 2. Model weight file: model.safetensors; - 3. Model code: other .py files. + * Model configuration file: config.json; + * Model weight file: model.safetensors; + * Model code: other .py files. **The SQL syntax for registering a custom model is as follows:** diff --git a/src/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_timecho.md b/src/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_timecho.md index 5fa365dd5..1bc14c36f 100644 --- a/src/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_timecho.md +++ b/src/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_timecho.md @@ -217,7 +217,7 @@ IoTDB> show models 1. AINode currently uses transformers version v4.56.2, so when building the model, it is necessary to **avoid inheriting low-version (<4.50) interfaces**; 2. The model needs to inherit a type of AINode inference task pipeline (currently supports the forecasting pipeline): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py ```Python class BasicPipeline(ABC): @@ -311,13 +311,13 @@ IoTDB> show models } ``` - 1. Must specify the model Config class and model class through auto\_map; - 2. Must integrate and specify the inference pipeline class; - 3. For AINode-managed built-in (builtin) and custom (user\_defined) models, the model category (model\_type) also serves as a unique identifier. That is, the model category to be registered must not be duplicated with any existing model type. Models created through fine-tuning will inherit the model category of the original model. + * Must specify the model Config class and model class through auto\_map; + * Must integrate and specify the inference pipeline class; + * For AINode-managed built-in (builtin) and custom (user\_defined) models, the model category (model\_type) also serves as a unique identifier. That is, the model category to be registered must not be duplicated with any existing model type. Models created through fine-tuning will inherit the model category of the original model. 4. Ensure that the model directory to be registered contains the following files, and the model configuration file name and weight file name are not customizable: - 1. Model configuration file: config.json; - 2. Model weight file: model.safetensors; - 3. Model code: other .py files. + * Model configuration file: config.json; + * Model weight file: model.safetensors; + * Model code: other .py files. **The SQL syntax for registering a custom model is as follows:** diff --git a/src/UserGuide/latest-Table/AI-capability/AINode_Upgrade_apache.md b/src/UserGuide/latest-Table/AI-capability/AINode_Upgrade_apache.md index ddaac11b6..be7a0606b 100644 --- a/src/UserGuide/latest-Table/AI-capability/AINode_Upgrade_apache.md +++ b/src/UserGuide/latest-Table/AI-capability/AINode_Upgrade_apache.md @@ -163,8 +163,9 @@ It costs 1.615s 1. AINode uses Transformers v4.56.2; avoid inheriting interfaces from older versions (<4.50). 2. The model must inherit an AINode inference pipeline class (currently supports forecasting pipeline): + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py + ```python - # iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py class BasicPipeline(ABC): def __init__(self, model_id, **model_kwargs): self.model_info = model_info diff --git a/src/UserGuide/latest-Table/AI-capability/AINode_Upgrade_timecho.md b/src/UserGuide/latest-Table/AI-capability/AINode_Upgrade_timecho.md index f65465ee9..e53c4d202 100644 --- a/src/UserGuide/latest-Table/AI-capability/AINode_Upgrade_timecho.md +++ b/src/UserGuide/latest-Table/AI-capability/AINode_Upgrade_timecho.md @@ -97,19 +97,19 @@ SELECT * FROM FORECAST( * Built-in model inference does not require a registration process. By using the forecast function and specifying model_id, you can use the inference function of the model. * Parameter description -| Parameter Name | Parameter Type | Parameter Attributes | Description | Required | Notes | -|----------------|----------------|----------------------|-------------|----------|-------| -| model_id | Scalar parameter | String type | Unique identifier of the prediction model | Yes | | -| targets | Table parameter | SET SEMANTIC | Input data for the target variables to be predicted. IoTDB will automatically sort the data in ascending order of time before passing it to AINode. | Yes | Use SQL to describe the input data with target variables. If the input SQL is invalid, corresponding query errors will be reported. | -| history_covs | Scalar parameter | String type (valid table model query SQL), default: none | Specifies historical data of covariates for this prediction task, which are used to assist in predicting target variables. AINode will not output prediction results for historical covariates. Before passing data to the model, AINode will automatically sort the data in ascending order of time. | No | 1. Query results can only contain FIELD columns; 2. Other: Different models may have specific requirements, and errors will be thrown if not met. | -| future_covs | Scalar parameter | String type (valid table model query SQL), default: none | Specifies future data of some covariates for this prediction task, which are used to assist in predicting target variables. Before passing data to the model, AINode will automatically sort the data in ascending order of time. | No | 1. Can only be specified when history_covs is set; 2. The covariate names involved must be a subset of history_covs; 3. Query results can only contain FIELD columns; 4. Other: Different models may have specific requirements, and errors will be thrown if not met. | -| auto_adapt | Scalar parameter | Boolean type, default value: true | Whether to enable adaptive processing for covariate inference.(Support from V2.0.8.2) | No | When adaptive mode is enabled: 1. If the set of future covariates (`future_covs`) is not a subset of the historical covariates (`history_covs`), any future covariates not present in the historical set will be automatically discarded. 2. If the length of any historical covariate does not match the length of the input target variable: a. If shorter, pad zeros at the beginning; b. If longer, discard the earliest data points. 3. If the length of any future covariate does not match the prediction length (`output_length`): a. If shorter, pad zeros at the end; b. If longer, discard the most recent data points. | -| output_start_time | Scalar parameter | Timestamp type. Default value: last timestamp of target variable + output_interval | Starting timestamp of output prediction points [i.e., forecast start time] | No | Must be greater than the maximum timestamp of target variable timestamps | -| output_length | Scalar parameter | INT32 type. Default value: 96 | Output window size | No | Must be greater than 0 | -| output_interval | Scalar parameter | Time interval type. Default value: (last timestamp - first timestamp of input data) / n - 1 | Time interval between output prediction points. Supported units: ns, us, ms, s, m, h, d, w | No | Must be greater than 0 | -| timecol | Scalar parameter | String type. Default value: time | Name of time column | No | Must be a TIMESTAMP column existing in targets | -| preserve_input | Scalar parameter | Boolean type. Default value: false | Whether to retain all original rows of target variable input in the output result set | No | | -| model_options | Scalar parameter | String type. Default value: empty string | Key-value pairs related to the model, such as whether to normalize the input. Different key-value pairs are separated by ';'. | No | | +| Parameter Name | Parameter Type | Parameter Attributes | Description | Required | Notes | +|----------------|----------------|----------------------|-------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| model_id | Scalar parameter | String type | Unique identifier of the prediction model | Yes | | +| targets | Table parameter | SET SEMANTIC | Input data for the target variables to be predicted. IoTDB will automatically sort the data in ascending order of time before passing it to AINode. | Yes | Use SQL to describe the input data with target variables. If the input SQL is invalid, corresponding query errors will be reported. | +| history_covs | Scalar parameter | String type (valid table model query SQL), default: none | Specifies historical data of covariates for this prediction task, which are used to assist in predicting target variables. AINode will not output prediction results for historical covariates. Before passing data to the model, AINode will automatically sort the data in ascending order of time. | No | 1. Query results can only contain FIELD columns;
2. Other: Different models may have specific requirements, and errors will be thrown if not met. | +| future_covs | Scalar parameter | String type (valid table model query SQL), default: none | Specifies future data of some covariates for this prediction task, which are used to assist in predicting target variables. Before passing data to the model, AINode will automatically sort the data in ascending order of time. | No | 1. Can only be specified when history_covs is set;
2. The covariate names involved must be a subset of history_covs;
3. Query results can only contain FIELD columns;
4. Other: Different models may have specific requirements, and errors will be thrown if not met. | +| auto_adapt | Scalar parameter | Boolean type, default value: true | Whether to enable adaptive processing for covariate inference.(Support from V2.0.8.2) | No | When adaptive mode is enabled:
1. If the set of future covariates (`future_covs`) is not a subset of the historical covariates (`history_covs`), any future covariates not present in the historical set will be automatically discarded.
2. If the length of any historical covariate does not match the length of the input target variable: a. If shorter, pad zeros at the beginning; b. If longer, discard the earliest data points.
3. If the length of any future covariate does not match the prediction length (`output_length`): a. If shorter, pad zeros at the end; b. If longer, discard the most recent data points. | +| output_start_time | Scalar parameter | Timestamp type. Default value: last timestamp of target variable + output_interval | Starting timestamp of output prediction points [i.e., forecast start time] | No | Must be greater than the maximum timestamp of target variable timestamps | +| output_length | Scalar parameter | INT32 type. Default value: 96 | Output window size | No | Must be greater than 0 | +| output_interval | Scalar parameter | Time interval type. Default value: (last timestamp - first timestamp of input data) / n - 1 | Time interval between output prediction points. Supported units: ns, us, ms, s, m, h, d, w | No | Must be greater than 0 | +| timecol | Scalar parameter | String type. Default value: time | Name of time column | No | Must be a TIMESTAMP column existing in targets | +| preserve_input | Scalar parameter | Boolean type. Default value: false | Whether to retain all original rows of target variable input in the output result set | No | | +| model_options | Scalar parameter | String type. Default value: empty string | Key-value pairs related to the model, such as whether to normalize the input. Different key-value pairs are separated by ';'. | No | | Notes: * **Default behavior**: Predict all columns of targets. Currently, only supports INT32, INT64, FLOAT, DOUBLE types. @@ -186,6 +186,17 @@ create table tab_real (target1 DOUBLE FIELD, target2 DOUBLE FIELD, cov1 DOUBLE F Prepare original data ```SQL +-- Insert statement +IoTDB:etth> INSERT INTO tab_real (time, target1, target2, cov1, cov2, cov3) VALUES +(1, 1.0, 1.0, 1.0, 1.0, 1.0), +(2, 2.0, 2.0, 2.0, 2.0, 2.0), +(3, 3.0, 3.0, 3.0, 3.0, 3.0), +(4, 4.0, 4.0, 4.0, 4.0, 4.0), +(5, 5.0, 5.0, 5.0, 5.0, 5.0), +(6, 6.0, 6.0, 6.0, 6.0, 6.0), +(7, NULL, NULL, NULL, NULL, 7.0), +(8, NULL, NULL, NULL, NULL, 8.0); + IoTDB:etth> SELECT * FROM tab_real +-----------------------------+-------+-------+----+----+----+ | time|target1|target2|cov1|cov2|cov3| @@ -199,18 +210,6 @@ IoTDB:etth> SELECT * FROM tab_real |1970-01-01T08:00:00.007+08:00| null| null|null|null| 7.0| |1970-01-01T08:00:00.008+08:00| null| null|null|null| 8.0| +-----------------------------+-------+-------+----+----+----+ - - --- Insert statement -IoTDB:etth> INSERT INTO tab_real (time, target1, target2, cov1, cov2, cov3) VALUES -(1, 1.0, 1.0, 1.0, 1.0, 1.0), -(2, 2.0, 2.0, 2.0, 2.0, 2.0), -(3, 3.0, 3.0, 3.0, 3.0, 3.0), -(4, 4.0, 4.0, 4.0, 4.0, 4.0), -(5, 5.0, 5.0, 5.0, 5.0, 5.0), -(6, 6.0, 6.0, 6.0, 6.0, 6.0), -(7, NULL, NULL, NULL, NULL, 7.0), -(8, NULL, NULL, NULL, NULL, 8.0); ``` * Prediction task 1: Use historical covariates cov1, cov2, and cov3 to assist in predicting target variables target1 and target2. @@ -486,7 +485,7 @@ IoTDB> show models 1. AINode currently uses transformers version 4.56.2, so when building the model, avoid inheriting interfaces from lower versions (<4.50); 2. The model must inherit a pipeline for inference tasks of AINode (currently supports prediction pipeline): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py ```Python class BasicPipeline(ABC): @@ -580,13 +579,13 @@ IoTDB> show models } ``` - 1. Must specify the Config class and model class through auto_map; - 2. Must integrate and specify the inference pipeline class; - 3. For built-in (builtin) and custom (user_defined) models managed by AINode, the model category (model_type) also serves as a unique identifier. That is, the model category to be registered must not duplicate any existing model types. Models created through fine-tuning will inherit the model category of the original model. + * Must specify the Config class and model class through auto_map; + * Must integrate and specify the inference pipeline class; + * For built-in (builtin) and custom (user_defined) models managed by AINode, the model category (model_type) also serves as a unique identifier. That is, the model category to be registered must not duplicate any existing model types. Models created through fine-tuning will inherit the model category of the original model. 4. Ensure the model directory to be registered contains the following files, and the model configuration file name and weight file name are not customizable: - 1. Model configuration file: config.json; - 2. Model weight file: model.safetensors; - 3. Model code: other .py files. + * Model configuration file: config.json; + * Model weight file: model.safetensors; + * Model code: other .py files. **The SQL syntax for registering custom models is as follows:** diff --git a/src/UserGuide/latest/AI-capability/AINode_Upgrade_apache.md b/src/UserGuide/latest/AI-capability/AINode_Upgrade_apache.md index 95120ae19..836c10fb4 100644 --- a/src/UserGuide/latest/AI-capability/AINode_Upgrade_apache.md +++ b/src/UserGuide/latest/AI-capability/AINode_Upgrade_apache.md @@ -137,7 +137,7 @@ Total line number = 48 1. AINode currently uses transformers v4.56.2, so when building the model, avoid inheriting from low versions (<4.50) interfaces; 2. The model must inherit from a type of AINode inference task pipeline (currently supports forecast pipeline): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic_pipeline.py ```Python class BasicPipeline(ABC): @@ -231,13 +231,13 @@ Total line number = 48 } ``` - 1. Must specify the model's Config class and model class through auto_map; - 2. Must integrate and specify the inference pipeline class; - 3. For built-in (builtin) and user-defined (user_defined) models managed by AINode, the model category (model_type) also serves as a unique identifier. That is, the model category to be registered must not duplicate any existing model types. + * Must specify the model's Config class and model class through auto_map; + * Must integrate and specify the inference pipeline class; + * For built-in (builtin) and user-defined (user_defined) models managed by AINode, the model category (model_type) also serves as a unique identifier. That is, the model category to be registered must not duplicate any existing model types. 4. Ensure the model directory to be registered contains the following files, and the model configuration file name and weight file name are not customizable: - 1. Model configuration file: config.json; - 2. Model weight file: model.safetensors; - 3. Model code: other .py files. + * Model configuration file: config.json; + * Model weight file: model.safetensors; + * Model code: other .py files. **The SQL syntax for registering a custom model is as follows:** diff --git a/src/UserGuide/latest/AI-capability/AINode_Upgrade_timecho.md b/src/UserGuide/latest/AI-capability/AINode_Upgrade_timecho.md index 5fa365dd5..1bc14c36f 100644 --- a/src/UserGuide/latest/AI-capability/AINode_Upgrade_timecho.md +++ b/src/UserGuide/latest/AI-capability/AINode_Upgrade_timecho.md @@ -217,7 +217,7 @@ IoTDB> show models 1. AINode currently uses transformers version v4.56.2, so when building the model, it is necessary to **avoid inheriting low-version (<4.50) interfaces**; 2. The model needs to inherit a type of AINode inference task pipeline (currently supports the forecasting pipeline): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py ```Python class BasicPipeline(ABC): @@ -311,13 +311,13 @@ IoTDB> show models } ``` - 1. Must specify the model Config class and model class through auto\_map; - 2. Must integrate and specify the inference pipeline class; - 3. For AINode-managed built-in (builtin) and custom (user\_defined) models, the model category (model\_type) also serves as a unique identifier. That is, the model category to be registered must not be duplicated with any existing model type. Models created through fine-tuning will inherit the model category of the original model. + * Must specify the model Config class and model class through auto\_map; + * Must integrate and specify the inference pipeline class; + * For AINode-managed built-in (builtin) and custom (user\_defined) models, the model category (model\_type) also serves as a unique identifier. That is, the model category to be registered must not be duplicated with any existing model type. Models created through fine-tuning will inherit the model category of the original model. 4. Ensure that the model directory to be registered contains the following files, and the model configuration file name and weight file name are not customizable: - 1. Model configuration file: config.json; - 2. Model weight file: model.safetensors; - 3. Model code: other .py files. + * Model configuration file: config.json; + * Model weight file: model.safetensors; + * Model code: other .py files. **The SQL syntax for registering a custom model is as follows:** diff --git a/src/zh/UserGuide/Master/Table/AI-capability/AINode_Upgrade_apache.md b/src/zh/UserGuide/Master/Table/AI-capability/AINode_Upgrade_apache.md index 71d1df39c..59a261acd 100644 --- a/src/zh/UserGuide/Master/Table/AI-capability/AINode_Upgrade_apache.md +++ b/src/zh/UserGuide/Master/Table/AI-capability/AINode_Upgrade_apache.md @@ -162,7 +162,7 @@ It costs 1.615s 1. AINode 目前使用 v4.56.2 版本的 transformers,构建模型时需**避免继承低版本(<4.50)接口**; 2. 模型需继承一类 AINode 的推理任务流水线(当前支持预测流水线): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py ```Python class BasicPipeline(ABC): @@ -256,13 +256,13 @@ It costs 1.615s } ``` - 1. 必须通过 auto\_map 指定模型的 Config 类和模型类; - 2. 必须集成并指定推理流水线类; - 3. 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复。 + * 必须通过 auto\_map 指定模型的 Config 类和模型类; + * 必须集成并指定推理流水线类; + * 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复。 4. 确保要注册的模型目录包含以下文件,且模型配置文件名称和权重文件名称不支持自定义: - 1. 模型配置文件:config.json; - 2. 模型权重文件:model.safetensors; - 3. 模型代码:其它 .py 文件。 + * 模型配置文件:config.json; + * 模型权重文件:model.safetensors; + * 模型代码:其它 .py 文件。 **注册自定义模型的 SQL 语法如下所示:** diff --git a/src/zh/UserGuide/Master/Table/AI-capability/AINode_Upgrade_timecho.md b/src/zh/UserGuide/Master/Table/AI-capability/AINode_Upgrade_timecho.md index cebe14b0c..541357b19 100644 --- a/src/zh/UserGuide/Master/Table/AI-capability/AINode_Upgrade_timecho.md +++ b/src/zh/UserGuide/Master/Table/AI-capability/AINode_Upgrade_timecho.md @@ -97,19 +97,19 @@ SELECT * FROM FORECAST( * 内置模型推理无需注册流程,通过 forecast 函数,指定 model\_id 就可以使用模型的推理功能。 * 参数介绍 -| 参数名 | 参数类型 | 参数属性 | 描述 | 是否必填 | 备注 | -|---------------------|-------|----------------------------------------------------|-----------------------------------------------------------------------------------------| ---------- |--------------------------------------------------------------------------------------------------------------------------| -| model\_id | 标量参数 | 字符串类型 | 预测所用模型的唯一标识 | 是| | -| targets | 表参数 | SET SEMANTIC | 待预测目标变量的输入数据。IoTDB会自动将数据按时间升序排序再交给AINode 。 | 是 | 使用 SQL 描述带预测目标变量的输入数据,输入的 SQL 不合法时会有对应的查询报错。 | -| history\_covs | 标量参数 | 字符串类型(合法的表模型查询 SQL)默认:无 | 指定此次预测任务的协变量的历史数据,这些数据用于辅助目标变量的预测,AINode 不会对历史协变量输出预测结果。在将数据给予模型前,AINode 会自动将数据按时间升序排序。 | 否 | 1. 查询结果只能包含 FIELD 列; 2. 其它:不同模型可能会有独特要求,不符合时会抛出对应的错误。 | -| future\_covs | 标量参数 | 字符串类型(合法的表模型查询 SQL) 默认:无 | 指定此次预测任务部分协变量的未来数据,这些数据用于辅助目标变量的预测。 在将数据给予模型前,AINode 会自动将数据按时间升序排序。 | 否 | 1. 当且仅当设置 history\_covs 时可以指定此参数;2. 所涉及协变量名称必须是 history\_covs 的子集; 3. 查询结果只能包含 FIELD 列; 4. 其它:不同模型可能会有独特要求,不符合时会抛出对应的错误。 | -| auto\_adapt | 标量参数 | 布尔类型,默认值:true | 是否为协变量推理开启自适应。(V2.0.8.2起支持) | 否 | 当开启自适应时:1. 若未来协变量集合future\_covs不是历史协变量集合history\_covs的子集,将自动抛弃那些不属于历史协变量的未来协变量。2. 若某个历史协变量的长度不等于输入目标变量的长度:a. 小于时,在其头部补 0;b. 大于时,自动丢弃其最早的数据。3. 若某个未来协变量的长度不等于预测长度output\_length: a. 小于时,在其尾部补 0;b. 大于时,自动丢弃其最新的数据。 | -| output\_start\_time | 标量参数 | 时间戳类型。 默认值:目标变量最后一个时间戳 + output\_interval | 输出的预测点的起始时间戳 【即起报时间】 | 否 | 必须大于目标变量时间戳的最大值 | -| output\_length | 标量参数 | INT32 类型。 默认值:96 | 输出窗口大小 | 否 | 必须大于 0 | -| output\_interval | 标量参数 | 时间间隔类型。 默认值:(输入数据的最后一个时间戳 - 输入数据的第一个时间戳) / n - 1 | 输出的预测点之间的时间间隔 支持的单位是 ns、us、ms、s、m、h、d、w | 否 | 必须大于 0 | -| timecol | 标量参数 | 字符串类型。 默认值:time | 时间列名 | 否 | 必须为存在于 targets 中的且数据类型为 TIMESTAMP 的列 | -| preserve\_input | 标量参数 | 布尔类型。 默认值:false | 是否在输出结果集中保留目标变量输入的所有原始行 | 否 | | -| model\_options | 标量参数 | 字符串类型。 默认值:空字符串 | 模型相关的 key-value 对,比如是否需要对输入进行归一化等。不同的 key-value 对以 ';' 间隔 | 否 | | +| 参数名 | 参数类型 | 参数属性 | 描述 | 是否必填 | 备注 | +|---------------------|-------|----------------------------------------------------|-----------------------------------------------------------------------------------------| ---------- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| model\_id | 标量参数 | 字符串类型 | 预测所用模型的唯一标识 | 是| | +| targets | 表参数 | SET SEMANTIC | 待预测目标变量的输入数据。IoTDB会自动将数据按时间升序排序再交给AINode 。 | 是 | 使用 SQL 描述带预测目标变量的输入数据,输入的 SQL 不合法时会有对应的查询报错。 | +| history\_covs | 标量参数 | 字符串类型(合法的表模型查询 SQL)默认:无 | 指定此次预测任务的协变量的历史数据,这些数据用于辅助目标变量的预测,AINode 不会对历史协变量输出预测结果。在将数据给予模型前,AINode 会自动将数据按时间升序排序。 | 否 | 1. 查询结果只能包含 FIELD 列;
2. 其它:不同模型可能会有独特要求,不符合时会抛出对应的错误。 | +| future\_covs | 标量参数 | 字符串类型(合法的表模型查询 SQL) 默认:无 | 指定此次预测任务部分协变量的未来数据,这些数据用于辅助目标变量的预测。 在将数据给予模型前,AINode 会自动将数据按时间升序排序。 | 否 | 1. 当且仅当设置 history\_covs 时可以指定此参数;
2. 所涉及协变量名称必须是 history\_covs 的子集;
3. 查询结果只能包含 FIELD 列;
4. 其它:不同模型可能会有独特要求,不符合时会抛出对应的错误。 | +| auto\_adapt | 标量参数 | 布尔类型,默认值:true | 是否为协变量推理开启自适应。(V2.0.8.2起支持) | 否 | 当开启自适应时:
1. 若未来协变量集合future\_covs不是历史协变量集合history\_covs的子集,将自动抛弃那些不属于历史协变量的未来协变量。
2. 若某个历史协变量的长度不等于输入目标变量的长度:a. 小于时,在其头部补 0;b. 大于时,自动丢弃其最早的数据。
3. 若某个未来协变量的长度不等于预测长度output\_length: a. 小于时,在其尾部补 0;b. 大于时,自动丢弃其最新的数据。 | +| output\_start\_time | 标量参数 | 时间戳类型。 默认值:目标变量最后一个时间戳 + output\_interval | 输出的预测点的起始时间戳 【即起报时间】 | 否 | 必须大于目标变量时间戳的最大值 | +| output\_length | 标量参数 | INT32 类型。 默认值:96 | 输出窗口大小 | 否 | 必须大于 0 | +| output\_interval | 标量参数 | 时间间隔类型。 默认值:(输入数据的最后一个时间戳 - 输入数据的第一个时间戳) / n - 1 | 输出的预测点之间的时间间隔 支持的单位是 ns、us、ms、s、m、h、d、w | 否 | 必须大于 0 | +| timecol | 标量参数 | 字符串类型。 默认值:time | 时间列名 | 否 | 必须为存在于 targets 中的且数据类型为 TIMESTAMP 的列 | +| preserve\_input | 标量参数 | 布尔类型。 默认值:false | 是否在输出结果集中保留目标变量输入的所有原始行 | 否 | | +| model\_options | 标量参数 | 字符串类型。 默认值:空字符串 | 模型相关的 key-value 对,比如是否需要对输入进行归一化等。不同的 key-value 对以 ';' 间隔 | 否 | | 说明: @@ -186,6 +186,17 @@ create table tab_real (target1 DOUBLE FIELD, target2 DOUBLE FIELD, cov1 DOUBLE F 准备原始数据 ```SQL +--写入语句 +IoTDB:etth> INSERT INTO tab_real (time, target1, target2, cov1, cov2, cov3) VALUES +(1, 1.0, 1.0, 1.0, 1.0, 1.0), +(2, 2.0, 2.0, 2.0, 2.0, 2.0), +(3, 3.0, 3.0, 3.0, 3.0, 3.0), +(4, 4.0, 4.0, 4.0, 4.0, 4.0), +(5, 5.0, 5.0, 5.0, 5.0, 5.0), +(6, 6.0, 6.0, 6.0, 6.0, 6.0), +(7, NULL, NULL, NULL, NULL, 7.0), +(8, NULL, NULL, NULL, NULL, 8.0); + IoTDB:etth> SELECT * FROM tab_real +-----------------------------+-------+-------+----+----+----+ | time|target1|target2|cov1|cov2|cov3| @@ -199,18 +210,6 @@ IoTDB:etth> SELECT * FROM tab_real |1970-01-01T08:00:00.007+08:00| null| null|null|null| 7.0| |1970-01-01T08:00:00.008+08:00| null| null|null|null| 8.0| +-----------------------------+-------+-------+----+----+----+ - - ---写入语句 -IoTDB:etth> INSERT INTO tab_real (time, target1, target2, cov1, cov2, cov3) VALUES -(1, 1.0, 1.0, 1.0, 1.0, 1.0), -(2, 2.0, 2.0, 2.0, 2.0, 2.0), -(3, 3.0, 3.0, 3.0, 3.0, 3.0), -(4, 4.0, 4.0, 4.0, 4.0, 4.0), -(5, 5.0, 5.0, 5.0, 5.0, 5.0), -(6, 6.0, 6.0, 6.0, 6.0, 6.0), -(7, NULL, NULL, NULL, NULL, 7.0), -(8, NULL, NULL, NULL, NULL, 8.0); ``` * 预测任务一:使用历史协变量 cov1,cov2 和 cov3 辅助预测目标变量 target1 和 target2。 diff --git a/src/zh/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_apache.md b/src/zh/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_apache.md index 8a9fdb274..95356315b 100644 --- a/src/zh/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_apache.md +++ b/src/zh/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_apache.md @@ -138,7 +138,7 @@ Total line number = 48 1. AINode 目前使用 v4.56.2 版本的 transformers,构建模型时需**避免继承低版本(<4.50)接口**; 2. 模型需继承一类 AINode 的推理任务流水线(当前支持预测流水线): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py ```Python class BasicPipeline(ABC): @@ -232,13 +232,13 @@ Total line number = 48 } ``` - 1. 必须通过 auto\_map 指定模型的 Config 类和模型类; - 2. 必须集成并指定推理流水线类; - 3. 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复。 + * 必须通过 auto\_map 指定模型的 Config 类和模型类; + * 必须集成并指定推理流水线类; + * 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复。 4. 确保要注册的模型目录包含以下文件,且模型配置文件名称和权重文件名称不支持自定义: - 1. 模型配置文件:config.json; - 2. 模型权重文件:model.safetensors; - 3. 模型代码:其它 .py 文件。 + * 模型配置文件:config.json; + * 模型权重文件:model.safetensors; + * 模型代码:其它 .py 文件。 **注册自定义模型的 SQL 语法如下所示:** diff --git a/src/zh/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_timecho.md b/src/zh/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_timecho.md index d637cb0f6..1cffb75ce 100644 --- a/src/zh/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_timecho.md +++ b/src/zh/UserGuide/Master/Tree/AI-capability/AINode_Upgrade_timecho.md @@ -219,7 +219,7 @@ IoTDB> show models 1. AINode 目前使用 v4.56.2 版本的 transformers,构建模型时需**避免继承低版本(<4.50)接口**; 2. 模型需继承一类 AINode 的推理任务流水线(当前支持预测流水线): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py ```Python class BasicPipeline(ABC): @@ -313,13 +313,13 @@ IoTDB> show models } ``` - 1. 必须通过 auto\_map 指定模型的 Config 类和模型类; - 2. 必须集成并指定推理流水线类; - 3. 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复,通过微调创建的模型将继承原模型的模型类别。 + * 必须通过 auto\_map 指定模型的 Config 类和模型类; + * 必须集成并指定推理流水线类; + * 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复,通过微调创建的模型将继承原模型的模型类别。 4. 确保要注册的模型目录包含以下文件,且模型配置文件名称和权重文件名称不支持自定义: - 1. 模型配置文件:config.json; - 2. 模型权重文件:model.safetensors; - 3. 模型代码:其它 .py 文件。 + * 模型配置文件:config.json; + * 模型权重文件:model.safetensors; + * 模型代码:其它 .py 文件。 **注册自定义模型的 SQL 语法如下所示:** diff --git a/src/zh/UserGuide/latest-Table/AI-capability/AINode_Upgrade_apache.md b/src/zh/UserGuide/latest-Table/AI-capability/AINode_Upgrade_apache.md index 71d1df39c..59a261acd 100644 --- a/src/zh/UserGuide/latest-Table/AI-capability/AINode_Upgrade_apache.md +++ b/src/zh/UserGuide/latest-Table/AI-capability/AINode_Upgrade_apache.md @@ -162,7 +162,7 @@ It costs 1.615s 1. AINode 目前使用 v4.56.2 版本的 transformers,构建模型时需**避免继承低版本(<4.50)接口**; 2. 模型需继承一类 AINode 的推理任务流水线(当前支持预测流水线): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py ```Python class BasicPipeline(ABC): @@ -256,13 +256,13 @@ It costs 1.615s } ``` - 1. 必须通过 auto\_map 指定模型的 Config 类和模型类; - 2. 必须集成并指定推理流水线类; - 3. 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复。 + * 必须通过 auto\_map 指定模型的 Config 类和模型类; + * 必须集成并指定推理流水线类; + * 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复。 4. 确保要注册的模型目录包含以下文件,且模型配置文件名称和权重文件名称不支持自定义: - 1. 模型配置文件:config.json; - 2. 模型权重文件:model.safetensors; - 3. 模型代码:其它 .py 文件。 + * 模型配置文件:config.json; + * 模型权重文件:model.safetensors; + * 模型代码:其它 .py 文件。 **注册自定义模型的 SQL 语法如下所示:** diff --git a/src/zh/UserGuide/latest-Table/AI-capability/AINode_Upgrade_timecho.md b/src/zh/UserGuide/latest-Table/AI-capability/AINode_Upgrade_timecho.md index cebe14b0c..541357b19 100644 --- a/src/zh/UserGuide/latest-Table/AI-capability/AINode_Upgrade_timecho.md +++ b/src/zh/UserGuide/latest-Table/AI-capability/AINode_Upgrade_timecho.md @@ -97,19 +97,19 @@ SELECT * FROM FORECAST( * 内置模型推理无需注册流程,通过 forecast 函数,指定 model\_id 就可以使用模型的推理功能。 * 参数介绍 -| 参数名 | 参数类型 | 参数属性 | 描述 | 是否必填 | 备注 | -|---------------------|-------|----------------------------------------------------|-----------------------------------------------------------------------------------------| ---------- |--------------------------------------------------------------------------------------------------------------------------| -| model\_id | 标量参数 | 字符串类型 | 预测所用模型的唯一标识 | 是| | -| targets | 表参数 | SET SEMANTIC | 待预测目标变量的输入数据。IoTDB会自动将数据按时间升序排序再交给AINode 。 | 是 | 使用 SQL 描述带预测目标变量的输入数据,输入的 SQL 不合法时会有对应的查询报错。 | -| history\_covs | 标量参数 | 字符串类型(合法的表模型查询 SQL)默认:无 | 指定此次预测任务的协变量的历史数据,这些数据用于辅助目标变量的预测,AINode 不会对历史协变量输出预测结果。在将数据给予模型前,AINode 会自动将数据按时间升序排序。 | 否 | 1. 查询结果只能包含 FIELD 列; 2. 其它:不同模型可能会有独特要求,不符合时会抛出对应的错误。 | -| future\_covs | 标量参数 | 字符串类型(合法的表模型查询 SQL) 默认:无 | 指定此次预测任务部分协变量的未来数据,这些数据用于辅助目标变量的预测。 在将数据给予模型前,AINode 会自动将数据按时间升序排序。 | 否 | 1. 当且仅当设置 history\_covs 时可以指定此参数;2. 所涉及协变量名称必须是 history\_covs 的子集; 3. 查询结果只能包含 FIELD 列; 4. 其它:不同模型可能会有独特要求,不符合时会抛出对应的错误。 | -| auto\_adapt | 标量参数 | 布尔类型,默认值:true | 是否为协变量推理开启自适应。(V2.0.8.2起支持) | 否 | 当开启自适应时:1. 若未来协变量集合future\_covs不是历史协变量集合history\_covs的子集,将自动抛弃那些不属于历史协变量的未来协变量。2. 若某个历史协变量的长度不等于输入目标变量的长度:a. 小于时,在其头部补 0;b. 大于时,自动丢弃其最早的数据。3. 若某个未来协变量的长度不等于预测长度output\_length: a. 小于时,在其尾部补 0;b. 大于时,自动丢弃其最新的数据。 | -| output\_start\_time | 标量参数 | 时间戳类型。 默认值:目标变量最后一个时间戳 + output\_interval | 输出的预测点的起始时间戳 【即起报时间】 | 否 | 必须大于目标变量时间戳的最大值 | -| output\_length | 标量参数 | INT32 类型。 默认值:96 | 输出窗口大小 | 否 | 必须大于 0 | -| output\_interval | 标量参数 | 时间间隔类型。 默认值:(输入数据的最后一个时间戳 - 输入数据的第一个时间戳) / n - 1 | 输出的预测点之间的时间间隔 支持的单位是 ns、us、ms、s、m、h、d、w | 否 | 必须大于 0 | -| timecol | 标量参数 | 字符串类型。 默认值:time | 时间列名 | 否 | 必须为存在于 targets 中的且数据类型为 TIMESTAMP 的列 | -| preserve\_input | 标量参数 | 布尔类型。 默认值:false | 是否在输出结果集中保留目标变量输入的所有原始行 | 否 | | -| model\_options | 标量参数 | 字符串类型。 默认值:空字符串 | 模型相关的 key-value 对,比如是否需要对输入进行归一化等。不同的 key-value 对以 ';' 间隔 | 否 | | +| 参数名 | 参数类型 | 参数属性 | 描述 | 是否必填 | 备注 | +|---------------------|-------|----------------------------------------------------|-----------------------------------------------------------------------------------------| ---------- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| model\_id | 标量参数 | 字符串类型 | 预测所用模型的唯一标识 | 是| | +| targets | 表参数 | SET SEMANTIC | 待预测目标变量的输入数据。IoTDB会自动将数据按时间升序排序再交给AINode 。 | 是 | 使用 SQL 描述带预测目标变量的输入数据,输入的 SQL 不合法时会有对应的查询报错。 | +| history\_covs | 标量参数 | 字符串类型(合法的表模型查询 SQL)默认:无 | 指定此次预测任务的协变量的历史数据,这些数据用于辅助目标变量的预测,AINode 不会对历史协变量输出预测结果。在将数据给予模型前,AINode 会自动将数据按时间升序排序。 | 否 | 1. 查询结果只能包含 FIELD 列;
2. 其它:不同模型可能会有独特要求,不符合时会抛出对应的错误。 | +| future\_covs | 标量参数 | 字符串类型(合法的表模型查询 SQL) 默认:无 | 指定此次预测任务部分协变量的未来数据,这些数据用于辅助目标变量的预测。 在将数据给予模型前,AINode 会自动将数据按时间升序排序。 | 否 | 1. 当且仅当设置 history\_covs 时可以指定此参数;
2. 所涉及协变量名称必须是 history\_covs 的子集;
3. 查询结果只能包含 FIELD 列;
4. 其它:不同模型可能会有独特要求,不符合时会抛出对应的错误。 | +| auto\_adapt | 标量参数 | 布尔类型,默认值:true | 是否为协变量推理开启自适应。(V2.0.8.2起支持) | 否 | 当开启自适应时:
1. 若未来协变量集合future\_covs不是历史协变量集合history\_covs的子集,将自动抛弃那些不属于历史协变量的未来协变量。
2. 若某个历史协变量的长度不等于输入目标变量的长度:a. 小于时,在其头部补 0;b. 大于时,自动丢弃其最早的数据。
3. 若某个未来协变量的长度不等于预测长度output\_length: a. 小于时,在其尾部补 0;b. 大于时,自动丢弃其最新的数据。 | +| output\_start\_time | 标量参数 | 时间戳类型。 默认值:目标变量最后一个时间戳 + output\_interval | 输出的预测点的起始时间戳 【即起报时间】 | 否 | 必须大于目标变量时间戳的最大值 | +| output\_length | 标量参数 | INT32 类型。 默认值:96 | 输出窗口大小 | 否 | 必须大于 0 | +| output\_interval | 标量参数 | 时间间隔类型。 默认值:(输入数据的最后一个时间戳 - 输入数据的第一个时间戳) / n - 1 | 输出的预测点之间的时间间隔 支持的单位是 ns、us、ms、s、m、h、d、w | 否 | 必须大于 0 | +| timecol | 标量参数 | 字符串类型。 默认值:time | 时间列名 | 否 | 必须为存在于 targets 中的且数据类型为 TIMESTAMP 的列 | +| preserve\_input | 标量参数 | 布尔类型。 默认值:false | 是否在输出结果集中保留目标变量输入的所有原始行 | 否 | | +| model\_options | 标量参数 | 字符串类型。 默认值:空字符串 | 模型相关的 key-value 对,比如是否需要对输入进行归一化等。不同的 key-value 对以 ';' 间隔 | 否 | | 说明: @@ -186,6 +186,17 @@ create table tab_real (target1 DOUBLE FIELD, target2 DOUBLE FIELD, cov1 DOUBLE F 准备原始数据 ```SQL +--写入语句 +IoTDB:etth> INSERT INTO tab_real (time, target1, target2, cov1, cov2, cov3) VALUES +(1, 1.0, 1.0, 1.0, 1.0, 1.0), +(2, 2.0, 2.0, 2.0, 2.0, 2.0), +(3, 3.0, 3.0, 3.0, 3.0, 3.0), +(4, 4.0, 4.0, 4.0, 4.0, 4.0), +(5, 5.0, 5.0, 5.0, 5.0, 5.0), +(6, 6.0, 6.0, 6.0, 6.0, 6.0), +(7, NULL, NULL, NULL, NULL, 7.0), +(8, NULL, NULL, NULL, NULL, 8.0); + IoTDB:etth> SELECT * FROM tab_real +-----------------------------+-------+-------+----+----+----+ | time|target1|target2|cov1|cov2|cov3| @@ -199,18 +210,6 @@ IoTDB:etth> SELECT * FROM tab_real |1970-01-01T08:00:00.007+08:00| null| null|null|null| 7.0| |1970-01-01T08:00:00.008+08:00| null| null|null|null| 8.0| +-----------------------------+-------+-------+----+----+----+ - - ---写入语句 -IoTDB:etth> INSERT INTO tab_real (time, target1, target2, cov1, cov2, cov3) VALUES -(1, 1.0, 1.0, 1.0, 1.0, 1.0), -(2, 2.0, 2.0, 2.0, 2.0, 2.0), -(3, 3.0, 3.0, 3.0, 3.0, 3.0), -(4, 4.0, 4.0, 4.0, 4.0, 4.0), -(5, 5.0, 5.0, 5.0, 5.0, 5.0), -(6, 6.0, 6.0, 6.0, 6.0, 6.0), -(7, NULL, NULL, NULL, NULL, 7.0), -(8, NULL, NULL, NULL, NULL, 8.0); ``` * 预测任务一:使用历史协变量 cov1,cov2 和 cov3 辅助预测目标变量 target1 和 target2。 diff --git a/src/zh/UserGuide/latest/AI-capability/AINode_Upgrade_apache.md b/src/zh/UserGuide/latest/AI-capability/AINode_Upgrade_apache.md index 8a9fdb274..95356315b 100644 --- a/src/zh/UserGuide/latest/AI-capability/AINode_Upgrade_apache.md +++ b/src/zh/UserGuide/latest/AI-capability/AINode_Upgrade_apache.md @@ -138,7 +138,7 @@ Total line number = 48 1. AINode 目前使用 v4.56.2 版本的 transformers,构建模型时需**避免继承低版本(<4.50)接口**; 2. 模型需继承一类 AINode 的推理任务流水线(当前支持预测流水线): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py ```Python class BasicPipeline(ABC): @@ -232,13 +232,13 @@ Total line number = 48 } ``` - 1. 必须通过 auto\_map 指定模型的 Config 类和模型类; - 2. 必须集成并指定推理流水线类; - 3. 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复。 + * 必须通过 auto\_map 指定模型的 Config 类和模型类; + * 必须集成并指定推理流水线类; + * 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复。 4. 确保要注册的模型目录包含以下文件,且模型配置文件名称和权重文件名称不支持自定义: - 1. 模型配置文件:config.json; - 2. 模型权重文件:model.safetensors; - 3. 模型代码:其它 .py 文件。 + * 模型配置文件:config.json; + * 模型权重文件:model.safetensors; + * 模型代码:其它 .py 文件。 **注册自定义模型的 SQL 语法如下所示:** diff --git a/src/zh/UserGuide/latest/AI-capability/AINode_Upgrade_timecho.md b/src/zh/UserGuide/latest/AI-capability/AINode_Upgrade_timecho.md index d637cb0f6..1cffb75ce 100644 --- a/src/zh/UserGuide/latest/AI-capability/AINode_Upgrade_timecho.md +++ b/src/zh/UserGuide/latest/AI-capability/AINode_Upgrade_timecho.md @@ -219,7 +219,7 @@ IoTDB> show models 1. AINode 目前使用 v4.56.2 版本的 transformers,构建模型时需**避免继承低版本(<4.50)接口**; 2. 模型需继承一类 AINode 的推理任务流水线(当前支持预测流水线): - 1. iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py + * iotdb-core/ainode/iotdb/ainode/core/inference/pipeline/basic\_pipeline.py ```Python class BasicPipeline(ABC): @@ -313,13 +313,13 @@ IoTDB> show models } ``` - 1. 必须通过 auto\_map 指定模型的 Config 类和模型类; - 2. 必须集成并指定推理流水线类; - 3. 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复,通过微调创建的模型将继承原模型的模型类别。 + * 必须通过 auto\_map 指定模型的 Config 类和模型类; + * 必须集成并指定推理流水线类; + * 对于 AINode 管理的内置(builtin)和自定义(user\_defined)模型,模型类别(model\_type)也作为不可重复的唯一标识。即,要注册的模型类别不得与任何已存在的模型类型重复,通过微调创建的模型将继承原模型的模型类别。 4. 确保要注册的模型目录包含以下文件,且模型配置文件名称和权重文件名称不支持自定义: - 1. 模型配置文件:config.json; - 2. 模型权重文件:model.safetensors; - 3. 模型代码:其它 .py 文件。 + * 模型配置文件:config.json; + * 模型权重文件:model.safetensors; + * 模型代码:其它 .py 文件。 **注册自定义模型的 SQL 语法如下所示:**