Skip to content

Commit a0760b4

Browse files
authored
Update ainode (#875)
* update ainode in table model * update ainode in tree model * add version * update model_id rules * fix import command * adjust show models result
1 parent af7257d commit a0760b4

20 files changed

Lines changed: 1008 additions & 746 deletions

File tree

113 KB
Loading
118 KB
Loading
130 KB
Loading
169 KB
Loading

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

Lines changed: 70 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,25 @@
2323

2424
AINode is a native IoTDB node that supports the registration, management, and invocation of time-series-related models. It comes with built-in industry-leading self-developed time-series large models, such as the Timer series developed by Tsinghua University. These models can be invoked through standard SQL statements, enabling real-time inference of time series data at the millisecond level, and supporting application scenarios such as trend forecasting, missing value imputation, and anomaly detection for time series data.
2525

26+
> Available since V2.0.5
27+
2628
The system architecture is shown below:
2729
::: center
28-
<img src="/img/AInode.png" style="zoom:50 percent" />
30+
<img src="/img/AINode-0-en.png" style="zoom:50 percent" />
2931
:::
32+
3033
The responsibilities of the three nodes are as follows:
3134

32-
- **ConfigNode**: responsible for storing and managing the meta-information of the model; responsible for distributed node management.
33-
- **DataNode**: responsible for receiving and parsing SQL requests from users; responsible for storing time-series data; responsible for preprocessing computation of data.
34-
- **AINode**: responsible for model file import creation and model inference.
35+
- **ConfigNode:**
36+
- Manages distributed nodes and handles load balancing across the system.
37+
- **DataNode:**
38+
- Receives and parses user SQL queries.
39+
- Stores time-series data.
40+
- Performs preprocessing computations on raw data.
41+
- **AINode:**
42+
- Manages and utilizes time-series models (including training/inference).
43+
- Supports deep learning and machine learning workflows.
44+
3545

3646
## 1. Advantageous features
3747

@@ -55,11 +65,11 @@ Compared with building a machine learning service alone, it has the following ad
5565
- **Create**: Load externally designed or trained model files/algorithms into AINode for unified management and usage by IoTDB.
5666
- **Inference**: Use the created model to complete time series analysis tasks applicable to the model on specified time series data.
5767
- **Built-in Capabilities**: AINode comes with machine learning algorithms or self-developed models for common time series analysis scenarios (e.g., forecasting and anomaly detection).
58-
![](/img/h3.png)
68+
![](/img/AINode-en.png)
5969

6070
## 3. Installation and Deployment
6171

62-
The deployment of AINode can be found in the document [Deployment Guidelines](../Deployment-and-Maintenance/AINode_Deployment_apache.md#ainode-deployment) .
72+
The deployment of AINode can be found in the document [AINode Deployment](../Deployment-and-Maintenance/AINode_Deployment_apache.md).
6373

6474

6575
## 4. Usage Guide
@@ -80,13 +90,13 @@ Models that meet the following criteria can be registered with AINode:
8090
The SQL syntax for model registration is defined as follows:
8191

8292
```SQL
83-
create model <model_name> using uri <uri>
93+
create model <model_id> using uri <uri>
8494
```
8595

8696
Detailed meanings of SQL parameters:
8797

88-
- **model_name**: The global unique identifier for the model, non-repeating. Model names have the following constraints:
89-
- Allowed characters: [0-9 a-z A-Z _] (letters, numbers, underscores)
98+
- **model_id**: The global unique identifier for the model, non-repeating. Model names have the following constraints:
99+
- Allowed characters: [0-9 a-z A-Z _] (letters, digits (not at the beginning), underscores (not at the beginning))
90100
- Length: 2-64 characters
91101
- Case-sensitive
92102
- **uri**: The resource path of the model registration files, which should include the **model structure and weight file `model.pt` and the model configuration file `config.yaml`**
@@ -117,7 +127,7 @@ In addition to registering local model files, remote resource paths can be speci
117127

118128
#### Example
119129

120-
The current example folder contains model.pt (trained model) and config.yaml with the following content:
130+
The [example folder](https://github.com/apache/iotdb/tree/master/integration-test/src/test/resources/ainode-example) contains model.pt (trained model) and config.yaml with the following content:
121131

122132
```YAML
123133
configs:
@@ -157,41 +167,54 @@ Registered models can be queried using the `show models` command. The SQL defini
157167
```SQL
158168
show models
159169

160-
show models <model_name>
170+
show models <model_id>
161171
```
162172

163173
In addition to displaying all models, specifying a `model_id` shows details of a specific model. The display includes:
164174

165-
| **ModelId** | **State** | **Configs** | **Attributes** |
166-
| ----------- | --------------------------------------------------------- | ------------------------------------------------ | -------------- |
167-
| Unique ID | Registration status (INACTIVE, LOADING, ACTIVE, DROPPING) | InputShape, outputShape, inputTypes, outputTypes | User notes |
175+
| **ModelId** | **ModelType** | **Category** | **State** |
176+
|-------------|---------------|----------------|-------------|
177+
| Model ID | Model Type | Model Category | Model State |
168178

169-
**State descriptions:**
179+
- Model State Transition Diagram
170180

171-
- **INACTIVE**: Model is unavailable.
172-
- **LOADING**: Model is being loaded.
173-
- **ACTIVE**: Model is available.
174-
- **DROPPING**: Model is being deleted.
181+
![](/img/AINode-State-apache-en.png)
175182

176-
#### Example
183+
**Instructions:**
184+
185+
1. Initialization:
186+
- When AINode starts, show models only displays BUILT-IN models.
187+
2. Custom Model Import:
188+
- Users can import custom models (marked as USER-DEFINED).
189+
- The system attempts to parse the ModelTypefrom the config file.
190+
- If parsing fails, the field remains empty.
191+
3. Foundation Model Weights:
192+
- Time-series foundation model weights are not bundled with AINode.
193+
- AINode automatically downloads them during startup.
194+
- Download state: LOADING.
195+
4. Download Outcomes:
196+
- Success → State changes to ACTIVE.
197+
- Failure → State changes to INACTIVE.
198+
199+
**Example**
177200

178201
```SQL
179202
IoTDB> show models
180-
181-
+---------------------+--------------------+--------+--------+
182-
| ModelId| ModelType|Category| State|
183-
+---------------------+--------------------+--------+--------+
184-
| arima| Arima|BUILT-IN| ACTIVE|
185-
| holtwinters| HoltWinters|BUILT-IN| ACTIVE|
186-
|exponential_smoothing|ExponentialSmoothing|BUILT-IN| ACTIVE|
187-
| naive_forecaster| NaiveForecaster|BUILT-IN| ACTIVE|
188-
| stl_forecaster| StlForecaster|BUILT-IN| ACTIVE|
189-
| gaussian_hmm| GaussianHmm|BUILT-IN| ACTIVE|
190-
| gmm_hmm| GmmHmm|BUILT-IN| ACTIVE|
191-
| stray| Stray|BUILT-IN| ACTIVE|
192-
| timer_xl| Timer-XL|BUILT-IN| ACTIVE|
193-
| sundial| Timer-Sundial|BUILT-IN| ACTIVE|
194-
+---------------------+--------------------+--------+--------+
203+
+---------------------+--------------------+--------------+---------+
204+
| ModelId| ModelType| Category| State|
205+
+---------------------+--------------------+--------------+---------+
206+
| arima| Arima| BUILT-IN| ACTIVE|
207+
| holtwinters| HoltWinters| BUILT-IN| ACTIVE|
208+
|exponential_smoothing|ExponentialSmoothing| BUILT-IN| ACTIVE|
209+
| naive_forecaster| NaiveForecaster| BUILT-IN| ACTIVE|
210+
| stl_forecaster| StlForecaster| BUILT-IN| ACTIVE|
211+
| gaussian_hmm| GaussianHmm| BUILT-IN| ACTIVE|
212+
| gmm_hmm| GmmHmm| BUILT-IN| ACTIVE|
213+
| stray| Stray| BUILT-IN| ACTIVE|
214+
| custom| | USER-DEFINED| ACTIVE|
215+
| timer_xl| Timer-XL| BUILT-IN| LOADING|
216+
| sundial| Timer-Sundial| BUILT-IN| ACTIVE|
217+
+---------------------+--------------------+--------------+---------+
195218
```
196219

197220
### 4.3 Deleting Models
@@ -243,18 +266,24 @@ Parameter descriptions:
243266

244267
1. The `forecast` function predicts all columns in the input table by default (excluding the time column and columns specified in `partition by`).
245268
2. The `forecast` function does not require the input data to be in any specific order. It sorts the input data in ascending order by the timestamp (specified by the `TIMECOL` parameter) before invoking the model for prediction.
246-
3. Different models have different requirements for the number of input data rows:
247-
- If the input data has fewer rows than the minimum requirement, an error will be thrown.
248-
- If the input data exceeds the maximum row limit, the last rows that meet the requirement will be automatically truncated for processing.
249-
- Among the currently built-in models in AINode, only `sundial` has a row limit. It supports a maximum of 2880 input rows. If exceeded, the last 2880 rows will be automatically used.
269+
3. Different models have varying requirements for the number of input data rows. If the input data has fewer rows than the minimum requirement, an error will be reported.
270+
- Among the current built-in models in AINode:
271+
- Timer-XL requires at least 96 rows of input data.
272+
- Timer-Sundial requires at least 16 rows of input data.
250273
4. The result columns of the `forecast` function include all input columns from the input table, with their original data types preserved. If `preserve_input = true`, an additional `is_input` column will be included to indicate whether a row is from the input data.
251274
- Currently, only columns of type INT32, INT64, FLOAT, or DOUBLE are supported for prediction. Otherwise, an error will occur: "The type of the column [%s] is [%s], only INT32, INT64, FLOAT, DOUBLE is allowed."
252275
5. `output_start_time` and `output_interval` only affect the generation of the timestamp column in the output results. Both are optional parameters:
253276
- `output_start_time` defaults to the last timestamp of the input data plus `output_interval`.
254277
- `output_interval` defaults to the sampling interval of the input data, calculated as: (last timestamp - first timestamp) / (number of rows - 1).
255278
- The timestamp of the Nth output row is calculated as: `output_start_time + (N - 1) * output_interval`.
256279

257-
#### Example
280+
**Example: Database and table must be pre-created**
281+
282+
```sql
283+
create database etth
284+
create table eg (hufl FLOAT FIELD, hull FLOAT FIELD, mufl FLOAT FIELD, mull FLOAT FIELD, lufl FLOAT FIELD, lull FLOAT FIELD, ot FLOAT FIELD)
285+
```
286+
258287

259288
Using the ETTh1-tab dataset:[ETTh1-tab](/img/ETTh1-tab.csv)
260289

@@ -314,7 +343,7 @@ It costs 1.615s
314343
315344
### 4.5 Time Series Large Model Import Steps
316345
317-
AINode supports multiple time series large models. For deployment, refer to [Time Series Large Model](https://timecho.com/docs/zh/UserGuide/latest/AI-capability/TimeSeries-Large-Model.html)
346+
AINode supports multiple time series large models. For deployment, refer to [Time Series Large Model](../AI-capability/TimeSeries-Large-Model.md)
318347
319348
320349
## 5 Permission Management

0 commit comments

Comments
 (0)