blob: 42de32e1ea45b30df1353082e2e74615a2e29da6 [file] [log] [blame]
import{_ as o,r as s,o as d,c as r,b as e,d as n,a as i,w as c,e as a}from"./app-Bp5kEZWW.js";const m={},u=a('<h1 id="ainode-machine-learning-framework" tabindex="-1"><a class="header-anchor" href="#ainode-machine-learning-framework"><span>AINode(Machine Learning Framework)</span></a></h1><p>AINode is the third internal node after ConfigNode and DataNode in Apache IoTDB, which extends the capability of machine learning analysis of time series by interacting with DataNode and ConfigNode of IoTDB cluster, supports the introduction of pre-existing machine learning models from the outside to be registered, and uses the registered models in the It supports the process of introducing existing machine learning models from outside for registration, and using the registered models to complete the time series analysis tasks on the specified time series data through simple SQL statements, which integrates the model creation, management and inference in the database engine. At present, we have provided machine learning algorithms or self-developed models for common timing analysis scenarios (e.g. prediction and anomaly detection).</p><p>The system architecture is shown below:</p><div style="text-align:center;"><img src="https://alioss.timecho.com/upload/AInode.png" style="zoom:50 percent;"></div><p>The responsibilities of the three nodes are as follows:</p><ul><li><strong>ConfigNode</strong>: responsible for storing and managing the meta-information of the model; responsible for distributed node management.</li><li><strong>DataNode</strong>: responsible for receiving and parsing SQL requests from users; responsible for storing time-series data; responsible for preprocessing computation of data.</li><li><strong>AINode</strong>: responsible for model file import creation and model inference.</li></ul><h2 id="_1-advantageous-features" tabindex="-1"><a class="header-anchor" href="#_1-advantageous-features"><span>1. Advantageous features</span></a></h2><p>Compared with building a machine learning service alone, it has the following advantages:</p><ul><li><p><strong>Simple and easy to use</strong>: no need to use Python or Java programming, the complete process of machine learning model management and inference can be completed using SQL statements. For example, to create a model, you can use the CREATE MODEL statement, and to reason with a model, you can use the CALL INFERENCE(...) statement. statement to create a model and CALL INFERENCE(...) statement to reason with a model, making it easier and more convenient to use.</p></li><li><p><strong>Avoid Data Migration</strong>: With IoTDB native machine learning, data stored in IoTDB can be directly applied to the inference of machine learning models without having to move the data to a separate machine learning service platform, which accelerates data processing, improves security, and reduces costs.</p></li></ul><figure><img src="https://alioss.timecho.com/upload/AInode1.png" alt="" tabindex="0" loading="lazy"><figcaption></figcaption></figure><ul><li><strong>Built-in Advanced Algorithms</strong>: supports industry-leading machine learning analytics algorithms covering typical timing analysis tasks, empowering the timing database with native data analysis capabilities. Such as: <ul><li><strong>Time Series Forecasting</strong>: learns patterns of change from past time series; thus outputs the most likely prediction of future series based on observations at a given past time.</li><li><strong>Anomaly Detection for Time Series</strong>: detects and identifies outliers in a given time series data, helping to discover anomalous behaviour in the time series.</li><li><strong>Annotation for Time Series (Time Series Annotation)</strong>: Adds additional information or markers, such as event occurrence, outliers, trend changes, etc., to each data point or specific time period to better understand and analyse the data.</li></ul></li></ul><h2 id="_2-basic-concepts" tabindex="-1"><a class="header-anchor" href="#_2-basic-concepts"><span>2. Basic Concepts</span></a></h2><ul><li><strong>Model</strong>: a machine learning model that takes time-series data as input and outputs the results or decisions of an analysis task. Model is the basic management unit of AINode, which supports adding (registration), deleting, checking, and using (inference) of models.</li><li><strong>Create</strong>: Load externally designed or trained model files or algorithms into MLNode for unified management and use by IoTDB.</li><li><strong>Inference</strong>: The process of using the created model to complete the timing analysis task applicable to the model on the specified timing data.</li><li><strong>Built-in capabilities</strong>: AINode comes with machine learning algorithms or home-grown models for common timing analysis scenarios (e.g., prediction and anomaly detection).</li></ul><div style="text-align:center;"><img src="https://alioss.timecho.com/upload/AInode2.png" style="zoom:50%;"></div><h2 id="_3-installation-and-deployment" tabindex="-1"><a class="header-anchor" href="#_3-installation-and-deployment"><span>3. Installation and Deployment</span></a></h2>',15),h=a(`<h2 id="_4-usage-guidelines" tabindex="-1"><a class="header-anchor" href="#_4-usage-guidelines"><span>4. Usage Guidelines</span></a></h2><p>AINode provides model creation and deletion process for deep learning models related to timing data. Built-in models do not need to be created and deleted, they can be used directly, and the built-in model instances created after inference is completed will be destroyed automatically.</p><h3 id="_4-1-registering-models" tabindex="-1"><a class="header-anchor" href="#_4-1-registering-models"><span>4.1 Registering Models</span></a></h3><p>A trained deep learning model can be registered by specifying the vector dimensions of the model&#39;s inputs and outputs, which can be used for model inference. The following is the SQL syntax definition for model registration.</p><div class="language-SQL line-numbers-mode" data-ext="SQL" data-title="SQL"><pre class="language-SQL"><code>create model &lt;model_name&gt; using uri &lt;uri&gt;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>The specific meanings of the parameters in the SQL are as follows:</p>`,6),p=e("li",null,[e("p",null,"model_name: a globally unique identifier for the model, which cannot be repeated. The model name has the following constraints:"),e("ul",null,[e("li",null,"Identifiers [ 0-9 a-z A-Z _ ] (letters, numbers, underscores) are allowed."),e("li",null,"Length is limited to 2-64 characters"),e("li",null,"Case sensitive")])],-1),v={href:"http://model.pt",target:"_blank",rel:"noopener noreferrer"},g=a("<ul><li><p>Model weight file: the weight file obtained after the training of the deep learning model is completed, currently supporting pytorch training of the .pt file</p></li><li><p>yaml metadata description file: parameters related to the model structure that need to be provided when the model is registered, which must contain the input and output dimensions of the model for model inference:</p><ul><li><table><thead><tr><th><strong>Parameter name</strong></th><th><strong>Parameter description</strong></th><th><strong>Example</strong></th></tr></thead><tbody><tr><td>input_shape</td><td>Rows and columns of model inputs for model inference</td><td>[96,2]</td></tr><tr><td>output_shape</td><td>rows and columns of model outputs, for model inference</td><td>[48,2]</td></tr></tbody></table></li><li><p>In addition to model inference, the data types of model input and output can be specified:</p></li><li><table><thead><tr><th><strong>Parameter name</strong></th><th><strong>Parameter description</strong></th><th><strong>Example</strong></th></tr></thead><tbody><tr><td>input_type</td><td>model input data type</td><td>[&#39;float32&#39;,&#39;float32&#39;]</td></tr><tr><td>output_type</td><td>data type of the model output</td><td>[&#39;float32&#39;,&#39;float32&#39;]</td></tr></tbody></table></li><li><p>In addition to this, additional notes can be specified for display during model management</p></li><li><table><thead><tr><th><strong>Parameter name</strong></th><th><strong>Parameter description</strong></th><th><strong>Examples</strong></th></tr></thead><tbody><tr><td>attributes</td><td>optional, user-defined model notes for model display</td><td>&#39;model_type&#39;: &#39;dlinear&#39;,&#39;kernel_size&#39;: &#39;25&#39;</td></tr></tbody></table></li></ul></li></ul>",1),b=e("p",null,"In addition to registration of local model files, registration can also be done by specifying remote resource paths via URIs, using open source model repositories (e.g. HuggingFace).",-1),f=e("h4",{id:"_4-1-1-example",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#_4-1-1-example"},[e("span",null,"4.1.1 Example")])],-1),_={href:"http://model.pt",target:"_blank",rel:"noopener noreferrer"},w={href:"http://model.pt",target:"_blank",rel:"noopener noreferrer"},T=a(`<div class="language-YAML line-numbers-mode" data-ext="YAML" data-title="YAML"><pre class="language-YAML"><code>configs.
# Required options
input_shape: [96, 2] # The model receives data in 96 rows x 2 columns.
output_shape: [48, 2] # Indicates that the model outputs 48 rows x 2 columns.
# Optional Default is all float32 and the number of columns is the number of columns in the shape.
input_type: [&quot;int64&quot;, &quot;int64&quot;] # Input data type, need to match the number of columns.
output_type: [&quot;text&quot;, &quot;int64&quot;] #Output data type, need to match the number of columns.
attributes: # Optional user-defined notes for the input.
&#39;model_type&#39;: &#39;dlinear&#39;
&#39;kernel_size&#39;: &#39;25&#39;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Specify this folder as the load path to register the model.</p><div class="language-SQL line-numbers-mode" data-ext="SQL" data-title="SQL"><pre class="language-SQL"><code>IoTDB&gt; create model dlinear_example using uri &quot;file://. /example&quot;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Alternatively, you can download the corresponding model file from huggingFace and register it.</p><div class="language-SQL line-numbers-mode" data-ext="SQL" data-title="SQL"><pre class="language-SQL"><code>IoTDB&gt; create model dlinear_example using uri &quot;https://huggingface.com/IoTDBML/dlinear/&quot;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>After the SQL is executed, the registration process will be carried out asynchronously, and you can view the registration status of the model through the model showcase (see the Model Showcase section), and the time consumed for successful registration is mainly affected by the size of the model file.</p><p>Once the model registration is complete, you can call specific functions and perform model inference by using normal queries.</p><h3 id="_4-2-viewing-models" tabindex="-1"><a class="header-anchor" href="#_4-2-viewing-models"><span>4.2 Viewing Models</span></a></h3><p>Successfully registered models can be queried for model-specific information through the show models command. The SQL definition is as follows:</p><div class="language-SQL line-numbers-mode" data-ext="SQL" data-title="SQL"><pre class="language-SQL"><code>show models
show models &lt;model_name&gt;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>In addition to displaying information about all models directly, you can specify a model id to view information about a specific model. The results of the model show contain the following information:</p><table><thead><tr><th><strong>ModelId</strong></th><th><strong>State</strong></th><th><strong>Configs</strong></th><th><strong>Attributes</strong></th></tr></thead><tbody><tr><td>Model Unique Identifier</td><td>Model Registration Status (LOADING, ACTIVE, DROPPING)</td><td>InputShape, outputShapeInputTypes, outputTypes</td><td>Model Notes</td></tr></tbody></table><p>State is used to show the current state of model registration, which consists of the following three stages</p><ul><li><strong>LOADING:</strong> The corresponding model meta information has been added to the configNode, and the model file is being transferred to the AINode node.</li><li><strong>ACTIVE:</strong> The model has been set up and the model is in the available state</li><li><strong>DROPPING:</strong> Model deletion is in progress, model related information is being deleted from configNode and AINode.</li><li><strong>UNAVAILABLE</strong>: Model creation failed, you can delete the failed model_name by drop model.</li></ul><h4 id="_4-2-1-example" tabindex="-1"><a class="header-anchor" href="#_4-2-1-example"><span>4.2.1 Example</span></a></h4><div class="language-SQL line-numbers-mode" data-ext="SQL" data-title="SQL"><pre class="language-SQL"><code>IoTDB&gt; show models
+---------------------+--------------------------+-----------+----------------------------+-----------------------+
| ModelId| ModelType| State| Configs| Notes|
+---------------------+--------------------------+-----------+----------------------------+-----------------------+
| dlinear_example| USER_DEFINED| ACTIVE| inputShape:[96,2]| |
| | | | outputShape:[48,2]| |
| | | | inputDataType:[float,float]| |
| | | |outputDataType:[float,float]| |
| _STLForecaster| BUILT_IN_FORECAST| ACTIVE| |Built-in model in IoTDB|
| _NaiveForecaster| BUILT_IN_FORECAST| ACTIVE| |Built-in model in IoTDB|
| _ARIMA| BUILT_IN_FORECAST| ACTIVE| |Built-in model in IoTDB|
|_ExponentialSmoothing| BUILT_IN_FORECAST| ACTIVE| |Built-in model in IoTDB|
| _GaussianHMM|BUILT_IN_ANOMALY_DETECTION| ACTIVE| |Built-in model in IoTDB|
| _GMMHMM|BUILT_IN_ANOMALY_DETECTION| ACTIVE| |Built-in model in IoTDB|
| _Stray|BUILT_IN_ANOMALY_DETECTION| ACTIVE| |Built-in model in IoTDB|
+---------------------+--------------------------+-----------+------------------------------------------------------------+-----------------------+
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>We have registered the corresponding model earlier, you can view the model status through the corresponding designation, active indicates that the model is successfully registered and can be used for inference.</p><h3 id="_4-3-delete-model" tabindex="-1"><a class="header-anchor" href="#_4-3-delete-model"><span>4.3 Delete Model</span></a></h3><p>For a successfully registered model, the user can delete it via SQL. In addition to deleting the meta information on the configNode, this operation also deletes all the related model files under the AINode. The SQL is as follows:</p><div class="language-SQL line-numbers-mode" data-ext="SQL" data-title="SQL"><pre class="language-SQL"><code>drop model &lt;model_name&gt;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>You need to specify the model model_name that has been successfully registered to delete the corresponding model. Since model deletion involves the deletion of data on multiple nodes, the operation will not be completed immediately, and the state of the model at this time is DROPPING, and the model in this state cannot be used for model inference.</p><h3 id="_4-4-using-built-in-model-reasoning" tabindex="-1"><a class="header-anchor" href="#_4-4-using-built-in-model-reasoning"><span>4.4 Using Built-in Model Reasoning</span></a></h3><p>The SQL syntax is as follows:</p><div class="language-SQL line-numbers-mode" data-ext="SQL" data-title="SQL"><pre class="language-SQL"><code>call inference(&lt;built_in_model_name&gt;,sql[,&lt;parameterName&gt;=&lt;parameterValue&gt;])
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Built-in model inference does not require a registration process, the inference function can be used by calling the inference function through the call keyword, and its corresponding parameters are described as follows:</p><ul><li><strong>built_in_model_name:</strong> built-in model name</li><li><strong>parameterName:</strong> parameter name</li><li><strong>parameterValue:</strong> parameter value</li></ul><h4 id="_4-4-1-built-in-models-and-parameter-descriptions" tabindex="-1"><a class="header-anchor" href="#_4-4-1-built-in-models-and-parameter-descriptions"><span>4.4.1 Built-in Models and Parameter Descriptions</span></a></h4><p>The following machine learning models are currently built-in, please refer to the following links for detailed parameter descriptions.</p>`,28),y=e("thead",null,[e("tr",null,[e("th",null,"Model"),e("th",null,"built_in_model_name"),e("th",null,"Task type"),e("th",null,"Parameter description")])],-1),I=e("td",null,"Arima",-1),S=e("td",null,"_Arima",-1),x=e("td",null,"Forecast",-1),L={href:"https://www.sktime.net/en/latest/api_reference/auto_generated/sktime.forecasting.arima.ARIMA.html?highlight=Arima",target:"_blank",rel:"noopener noreferrer"},A=e("td",null,"STLForecaster",-1),M=e("td",null,"_STLForecaster",-1),k=e("td",null,"Forecast",-1),D={href:"https://www.sktime.net/en/latest/api_reference/auto_generated/sktime.forecasting.trend.STLForecaster.html#sktime.forecasting.trend.STLForecaster",target:"_blank",rel:"noopener noreferrer"},N=e("td",null,"NaiveForecaster",-1),B=e("td",null,"_NaiveForecaster",-1),E=e("td",null,"Forecast",-1),Q={href:"https://www.sktime.net/en/latest/api_reference/auto_generated/sktime.forecasting.naive.NaiveForecaster.html#naiveforecaster",target:"_blank",rel:"noopener noreferrer"},q=e("td",null,"ExponentialSmoothing",-1),C=e("td",null,"_ExponentialSmoothing",-1),P=e("td",null,"Forecast",-1),U={href:"https://www.sktime.net/en/latest/api_reference/auto_generated/sktime.forecasting.exp_smoothing.ExponentialSmoothing.html",target:"_blank",rel:"noopener noreferrer"},F=e("td",null,"GaussianHMM",-1),R=e("td",null,"_GaussianHMM",-1),O=e("td",null,"Annotation",-1),z={href:"https://www.sktime.net/en/latest/api_reference/auto_generated/sktime.annotation.hmm_learn.gaussian.GaussianHMM.html",target:"_blank",rel:"noopener noreferrer"},G=e("td",null,"GMMHMM",-1),V=e("td",null,"_GMMHMM",-1),W=e("td",null,"Annotation",-1),H={href:"https://www.sktime.net/en/latest/api_reference/auto_generated/sktime.annotation.hmm_learn.gmm.GMMHMM.html",target:"_blank",rel:"noopener noreferrer"},Y=e("td",null,"Stray",-1),Z=e("td",null,"_Stray",-1),J=e("td",null,"Anomaly detection",-1),j={href:"https://www.sktime.net/en/latest/api_reference/auto_generated/sktime.annotation.stray.STRAY.html",target:"_blank",rel:"noopener noreferrer"},K=a(`<h4 id="_4-4-2-example" tabindex="-1"><a class="header-anchor" href="#_4-4-2-example"><span>4.4.2 Example</span></a></h4><p>The following is an example of an operation using built-in model inference. The built-in Stray model is used for anomaly detection algorithm. The input is <code>[144,1]</code> and the output is <code>[144,1]</code>. We use it for reasoning through SQL.</p><div class="language-SQL line-numbers-mode" data-ext="SQL" data-title="SQL"><pre class="language-SQL"><code>IoTDB&gt; select * from root.eg.airline
+-----------------------------+------------------+
| Time|root.eg.airline.s0|
+-----------------------------+------------------+
|1949-01-31T00:00:00.000+08:00| 224.0|
|1949-02-28T00:00:00.000+08:00| 118.0|
|1949-03-31T00:00:00.000+08:00| 132.0|
|1949-04-30T00:00:00.000+08:00| 129.0|
......
|1960-09-30T00:00:00.000+08:00| 508.0|
|1960-10-31T00:00:00.000+08:00| 461.0|
|1960-11-30T00:00:00.000+08:00| 390.0|
|1960-12-31T00:00:00.000+08:00| 432.0|
+-----------------------------+------------------+
Total line number = 144
IoTDB&gt; call inference(_Stray, &quot;select s0 from root.eg.airline&quot;, k=2)
+-------+
|output0|
+-------+
| 0|
| 0|
| 0|
| 0|
......
| 1|
| 1|
| 0|
| 0|
| 0|
| 0|
+-------+
Total line number = 144
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="_4-5-reasoning-with-deep-learning-models" tabindex="-1"><a class="header-anchor" href="#_4-5-reasoning-with-deep-learning-models"><span>4.5 Reasoning with Deep Learning Models</span></a></h3><p>The SQL syntax is as follows:</p><div class="language-SQL line-numbers-mode" data-ext="SQL" data-title="SQL"><pre class="language-SQL"><code>call inference(&lt;model_name&gt;,sql[,window=&lt;window_function&gt;])
window_function:
head(window_size)
tail(window_size)
count(window_size,sliding_step)
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>After completing the registration of the model, the inference function can be used by calling the inference function through the call keyword, and its corresponding parameters are described as follows:</p><ul><li><strong>model_name</strong>: corresponds to a registered model</li><li><strong>sql</strong>: sql query statement, the result of the query is used as input to the model for model inference. The dimensions of the rows and columns in the result of the query need to match the size specified in the specific model config. (It is not recommended to use the &#39;SELECT <em>&#39; clause for the sql here because in IoTDB, &#39;</em>&#39; does not sort the columns, so the order of the columns is undefined, you can use &#39;SELECT s0,s1&#39; to ensure that the columns order matches the expectations of the model input)</li><li><strong>window_function</strong>: Window functions that can be used in the inference process, there are currently three types of window functions provided to assist in model inference: <ul><li><p><strong>head(window_size)</strong>: Get the top window_size points in the data for model inference, this window can be used for data cropping.<br><img src="https://alioss.timecho.com/docs/img/s1.png" alt="" loading="lazy"></p></li><li><p><strong>tail(window_size)</strong>: get the last window_size point in the data for model inference, this window can be used for data cropping.<br><img src="https://alioss.timecho.com/docs/img/s2.png" alt="" loading="lazy"></p></li><li><p><strong>count(window_size, sliding_step):</strong> sliding window based on the number of points, the data in each window will be reasoned through the model respectively, as shown in the example below, window_size for 2 window function will be divided into three windows of the input dataset, and each window will perform reasoning operations to generate results respectively. The window can be used for continuous inference<br><img src="https://alioss.timecho.com/docs/img/s3.png" alt="" loading="lazy"></p></li></ul></li></ul><p><strong>Explanation 1</strong>: window can be used to solve the problem of cropping rows when the results of the sql query and the input row requirements of the model do not match. Note that when the number of columns does not match or the number of rows is directly less than the model requirement, the inference cannot proceed and an error message will be returned.</p><p><strong>Explanation 2</strong>: In deep learning applications, timestamp-derived features (time columns in the data) are often used as covariates in generative tasks, and are input into the model together to enhance the model, but the time columns are generally not included in the model&#39;s output. In order to ensure the generality of the implementation, the model inference results only correspond to the real output of the model, if the model does not output the time column, it will not be included in the results.</p><h4 id="_4-5-1-example" tabindex="-1"><a class="header-anchor" href="#_4-5-1-example"><span>4.5.1 Example</span></a></h4><p>The following is an example of inference in action using a deep learning model, for the <code>dlinear</code> prediction model with input <code>[96,2]</code> and output <code>[48,2]</code> mentioned above, which we use via SQL.</p><div class="language-Shell line-numbers-mode" data-ext="Shell" data-title="Shell"><pre class="language-Shell"><code>IoTDB&gt; select s1,s2 from root.**
+-----------------------------+-------------------+-------------------+
| Time| root.eg.etth.s0| root.eg.etth.s1|
+-----------------------------+-------------------+-------------------+
|1990-01-01T00:00:00.000+08:00| 0.7855| 1.611|
|1990-01-02T00:00:00.000+08:00| 0.7818| 1.61|
|1990-01-03T00:00:00.000+08:00| 0.7867| 1.6293|
|1990-01-04T00:00:00.000+08:00| 0.786| 1.637|
|1990-01-05T00:00:00.000+08:00| 0.7849| 1.653|
|1990-01-06T00:00:00.000+08:00| 0.7866| 1.6537|
|1990-01-07T00:00:00.000+08:00| 0.7886| 1.662|
......
|1990-03-31T00:00:00.000+08:00| 0.7585| 1.678|
|1990-04-01T00:00:00.000+08:00| 0.7587| 1.6763|
|1990-04-02T00:00:00.000+08:00| 0.76| 1.6813|
|1990-04-03T00:00:00.000+08:00| 0.7669| 1.684|
|1990-04-04T00:00:00.000+08:00| 0.7645| 1.677|
|1990-04-05T00:00:00.000+08:00| 0.7625| 1.68|
|1990-04-06T00:00:00.000+08:00| 0.7617| 1.6917|
+-----------------------------+-------------------+-------------------+
Total line number = 96
IoTDB&gt; call inference(dlinear_example,&quot;select s0,s1 from root.**&quot;)
+--------------------------------------------+-----------------------------+
| _result_0| _result_1|
+--------------------------------------------+-----------------------------+
| 0.726302981376648| 1.6549958229064941|
| 0.7354921698570251| 1.6482787370681763|
| 0.7238251566886902| 1.6278168201446533|
......
| 0.7692174911499023| 1.654654049873352|
| 0.7685555815696716| 1.6625318765640259|
| 0.7856493592262268| 1.6508299350738525|
+--------------------------------------------+-----------------------------+
Total line number = 48
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h4 id="_4-5-2-example-of-using-the-tail-head-window-function" tabindex="-1"><a class="header-anchor" href="#_4-5-2-example-of-using-the-tail-head-window-function"><span>4.5.2 Example of using the tail/head window function</span></a></h4><p>When the amount of data is variable and you want to take the latest 96 rows of data for inference, you can use the corresponding window function tail. head function is used in a similar way, except that it takes the earliest 96 points.</p><div class="language-Shell line-numbers-mode" data-ext="Shell" data-title="Shell"><pre class="language-Shell"><code>IoTDB&gt; select s1,s2 from root.**
+-----------------------------+-------------------+-------------------+
| Time| root.eg.etth.s0| root.eg.etth.s1|
+-----------------------------+-------------------+-------------------+
|1988-01-01T00:00:00.000+08:00| 0.7355| 1.211|
......
|1990-01-01T00:00:00.000+08:00| 0.7855| 1.611|
|1990-01-02T00:00:00.000+08:00| 0.7818| 1.61|
|1990-01-03T00:00:00.000+08:00| 0.7867| 1.6293|
|1990-01-04T00:00:00.000+08:00| 0.786| 1.637|
|1990-01-05T00:00:00.000+08:00| 0.7849| 1.653|
|1990-01-06T00:00:00.000+08:00| 0.7866| 1.6537|
|1990-01-07T00:00:00.000+08:00| 0.7886| 1.662|
......
|1990-03-31T00:00:00.000+08:00| 0.7585| 1.678|
|1990-04-01T00:00:00.000+08:00| 0.7587| 1.6763|
|1990-04-02T00:00:00.000+08:00| 0.76| 1.6813|
|1990-04-03T00:00:00.000+08:00| 0.7669| 1.684|
|1990-04-04T00:00:00.000+08:00| 0.7645| 1.677|
|1990-04-05T00:00:00.000+08:00| 0.7625| 1.68|
|1990-04-06T00:00:00.000+08:00| 0.7617| 1.6917|
+-----------------------------+-------------------+-------------------+
Total line number = 996
IoTDB&gt; call inference(dlinear_example,&quot;select s0,s1 from root.**&quot;,window=tail(96))
+--------------------------------------------+-----------------------------+
| _result_0| _result_1|
+--------------------------------------------+-----------------------------+
| 0.726302981376648| 1.6549958229064941|
| 0.7354921698570251| 1.6482787370681763|
| 0.7238251566886902| 1.6278168201446533|
......
| 0.7692174911499023| 1.654654049873352|
| 0.7685555815696716| 1.6625318765640259|
| 0.7856493592262268| 1.6508299350738525|
+--------------------------------------------+-----------------------------+
Total line number = 48
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h4 id="_4-5-3-example-of-using-the-count-window-function" tabindex="-1"><a class="header-anchor" href="#_4-5-3-example-of-using-the-count-window-function"><span>4.5.3 Example of using the count window function</span></a></h4><p>This window is mainly used for computational tasks, when the model corresponding to the task can only process a fixed row of data at a time and what is ultimately desired is indeed multiple sets of predictions, using this window function allows for sequential inference using a sliding window of points. Suppose we now have an anomaly detection model anomaly_example(input: [24,2], output[1,1]) that generates a 0/1 label for each row of data, an example of its use is shown below:</p><div class="language-Shell line-numbers-mode" data-ext="Shell" data-title="Shell"><pre class="language-Shell"><code>IoTDB&gt; select s1,s2 from root.**
+-----------------------------+-------------------+-------------------+
| Time| root.eg.etth.s0| root.eg.etth.s1|
+-----------------------------+-------------------+-------------------+
|1990-01-01T00:00:00.000+08:00| 0.7855| 1.611|
|1990-01-02T00:00:00.000+08:00| 0.7818| 1.61|
|1990-01-03T00:00:00.000+08:00| 0.7867| 1.6293|
|1990-01-04T00:00:00.000+08:00| 0.786| 1.637|
|1990-01-05T00:00:00.000+08:00| 0.7849| 1.653|
|1990-01-06T00:00:00.000+08:00| 0.7866| 1.6537|
|1990-01-07T00:00:00.000+08:00| 0.7886| 1.662|
......
|1990-03-31T00:00:00.000+08:00| 0.7585| 1.678|
|1990-04-01T00:00:00.000+08:00| 0.7587| 1.6763|
|1990-04-02T00:00:00.000+08:00| 0.76| 1.6813|
|1990-04-03T00:00:00.000+08:00| 0.7669| 1.684|
|1990-04-04T00:00:00.000+08:00| 0.7645| 1.677|
|1990-04-05T00:00:00.000+08:00| 0.7625| 1.68|
|1990-04-06T00:00:00.000+08:00| 0.7617| 1.6917|
+-----------------------------+-------------------+-------------------+
Total line number = 96
IoTDB&gt; call inference(anomaly_example,&quot;select s0,s1 from root.**&quot;,window=count(24,24))
+-------------------------+
| _result_0|
+-------------------------+
| 0|
| 1|
| 1|
| 0|
+-------------------------+
Total line number = 4
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>where the labels of each row in the result set correspond to the model output corresponding to the 16 rows of input.</p><h2 id="_5-privilege-management" tabindex="-1"><a class="header-anchor" href="#_5-privilege-management"><span>5. Privilege Management</span></a></h2><p>When using AINode related functions, the authentication of IoTDB itself can be used to do a permission management, users can only use the model management related functions when they have the USE_ML permission. When using the inference function, the user needs to have the permission to access the source sequence corresponding to the SQL of the input model.</p><table><thead><tr><th>Privilege Name</th><th>Privilege Scope</th><th>Administrator User (default ROOT)</th><th>Normal User</th><th>Path Related</th></tr></thead><tbody><tr><td>USE_MODEL</td><td>create model/show model/sdrop model</td><td>√</td><td>√ √</td><td>x</td></tr><tr><td></td><td></td><td>call inference</td><td></td><td></td></tr></tbody></table><h2 id="_6-practical-examples" tabindex="-1"><a class="header-anchor" href="#_6-practical-examples"><span>6. Practical Examples</span></a></h2><h3 id="_6-1-power-load-prediction" tabindex="-1"><a class="header-anchor" href="#_6-1-power-load-prediction"><span>6.1 Power Load Prediction</span></a></h3><p>In some industrial scenarios, there is a need to predict power loads, which can be used to optimise power supply, conserve energy and resources, support planning and expansion, and enhance power system reliability.</p>`,26),X={href:"https://alioss.timecho.com/docs/img/ETTh1.csv",target:"_blank",rel:"noopener noreferrer"},$=a(`<p>It contains power data collected at 1h intervals, and each data consists of load and oil temperature as High UseFul Load, High UseLess Load, Middle UseLess Load, Low UseFul Load, Low UseLess Load, Oil Temperature.</p><p>On this dataset, the model inference function of IoTDB-ML can predict the oil temperature in the future period of time through the relationship between the past values of high, middle and low use loads and the corresponding time stamp oil temperature, which empowers the automatic regulation and monitoring of grid transformers.</p><h4 id="step-1-data-import" tabindex="-1"><a class="header-anchor" href="#step-1-data-import"><span>Step 1: Data Import</span></a></h4><p>Users can import the ETT dataset into IoTDB using <code>import-csv.sh</code> in the tools folder</p><p><code>Bash bash . /import-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -f ... /... /ETTh1.csv </code></p><h4 id="step-2-model-import" tabindex="-1"><a class="header-anchor" href="#step-2-model-import"><span>Step 2: Model Import</span></a></h4><p>We can enter the following SQL in iotdb-cli to pull a trained model from huggingface for registration for subsequent inference.</p><div class="language-SQL line-numbers-mode" data-ext="SQL" data-title="SQL"><pre class="language-SQL"><code>create model dlinear using uri &#39;https://huggingface.co/hvlgo/dlinear/resolve/main&#39;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>This model is trained on the lighter weight deep model DLinear, which is able to capture as many trends within a sequence and relationships between variables as possible with relatively fast inference, making it more suitable for fast real-time prediction than other deeper models.</p><h4 id="step-3-model-inference" tabindex="-1"><a class="header-anchor" href="#step-3-model-inference"><span>Step 3: Model inference</span></a></h4><div class="language-Shell line-numbers-mode" data-ext="Shell" data-title="Shell"><pre class="language-Shell"><code>IoTDB&gt; select s0,s1,s2,s3,s4,s5,s6 from root.eg.etth LIMIT 96
+-----------------------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+
| Time|root.eg.etth.s0|root.eg.etth.s1|root.eg.etth.s2|root.eg.etth.s3|root.eg.etth.s4|root.eg.etth.s5|root.eg.etth.s6|
+-----------------------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+
|2017-10-20T00:00:00.000+08:00| 10.449| 3.885| 8.706| 2.025| 2.041| 0.944| 8.864|
|2017-10-20T01:00:00.000+08:00| 11.119| 3.952| 8.813| 2.31| 2.071| 1.005| 8.442|
|2017-10-20T02:00:00.000+08:00| 9.511| 2.88| 7.533| 1.564| 1.949| 0.883| 8.16|
|2017-10-20T03:00:00.000+08:00| 9.645| 2.21| 7.249| 1.066| 1.828| 0.914| 7.949|
......
|2017-10-23T20:00:00.000+08:00| 8.105| 0.938| 4.371| -0.569| 3.533| 1.279| 9.708|
|2017-10-23T21:00:00.000+08:00| 7.167| 1.206| 4.087| -0.462| 3.107| 1.432| 8.723|
|2017-10-23T22:00:00.000+08:00| 7.1| 1.34| 4.015| -0.32| 2.772| 1.31| 8.864|
|2017-10-23T23:00:00.000+08:00| 9.176| 2.746| 7.107| 1.635| 2.65| 1.097| 9.004|
+-----------------------------+---------------+---------------+---------------+---------------+---------------+---------------+---------------+
Total line number = 96
IoTDB&gt; call inference(dlinear_example, &quot;select s0,s1,s2,s3,s4,s5,s6 from root.eg.etth&quot;, window=head(96))
+-----------+----------+----------+------------+---------+----------+----------+
| output0| output1| output2| output3| output4| output5| output6|
+-----------+----------+----------+------------+---------+----------+----------+
| 10.319546| 3.1450553| 7.877341| 1.5723765|2.7303758| 1.1362307| 8.867775|
| 10.443649| 3.3286757| 7.8593454| 1.7675098| 2.560634| 1.1177158| 8.920919|
| 10.883752| 3.2341104| 8.47036| 1.6116762|2.4874182| 1.1760603| 8.798939|
......
| 8.0115595| 1.2995274| 6.9900327|-0.098746896| 3.04923| 1.176214| 9.548782|
| 8.612427| 2.5036244| 5.6790237| 0.66474205|2.8870275| 1.2051733| 9.330128|
| 10.096699| 3.399722| 6.9909| 1.7478468|2.7642853| 1.1119363| 9.541455|
+-----------+----------+----------+------------+---------+----------+----------+
Total line number = 48
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>We compare the results of the prediction of the oil temperature with the real results, and we can get the following image.</p><p>The data before 10/24 00:00 in the image is the past data input into the model, the yellow line after 10/24 00:00 is the prediction of oil temperature given by the model, and the blue colour is the actual oil temperature data in the dataset (used for comparison).</p><figure><img src="https://alioss.timecho.com/docs/img/s4.png" alt="" tabindex="0" loading="lazy"><figcaption></figcaption></figure><p>As can be seen, we have used the relationship between the six load information and the corresponding time oil temperatures for the past 96 hours (4 days) to model the possible changes in this data for the oil temperature for the next 48 hours (2 days) based on the inter-relationships between the sequences learned previously, and it can be seen that the predicted curves maintain a high degree of consistency in trend with the actual results after visualisation.</p><h3 id="_6-2-power-prediction" tabindex="-1"><a class="header-anchor" href="#_6-2-power-prediction"><span>6.2 Power Prediction</span></a></h3><p>Power monitoring of current, voltage and power data is required in substations for detecting potential grid problems, identifying faults in the power system, effectively managing grid loads and analysing power system performance and trends.</p><p>We have used the current, voltage and power data in a substation to form a dataset in a real scenario. The dataset consists of data such as A-phase voltage, B-phase voltage, and C-phase voltage collected every 5 - 6s for a time span of nearly four months in the substation.</p>`,18),ee={href:"https://alioss.timecho.com/docs/img/data.csv",target:"_blank",rel:"noopener noreferrer"},ne=a(`<p>On this dataset, the model inference function of IoTDB-ML can predict the C-phase voltage in the future period through the previous values and corresponding timestamps of A-phase voltage, B-phase voltage and C-phase voltage, empowering the monitoring management of the substation.</p><h4 id="step-1-data-import-1" tabindex="-1"><a class="header-anchor" href="#step-1-data-import-1"><span>Step 1: Data Import</span></a></h4><p>Users can import the dataset using <code>import-csv.sh</code> in the tools folder</p><div class="language-Bash line-numbers-mode" data-ext="Bash" data-title="Bash"><pre class="language-Bash"><code>bash ./import-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -f ... /... /data.csv
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h4 id="step-2-model-import-1" tabindex="-1"><a class="header-anchor" href="#step-2-model-import-1"><span>Step 2: Model Import</span></a></h4><p>We can enter the following SQL in iotdb-cli to pull a trained model from huggingface for registration for subsequent inference.</p><div class="language-SQL line-numbers-mode" data-ext="SQL" data-title="SQL"><pre class="language-SQL"><code>create model patchtst using uri \`https://huggingface.co/hvlgo/patchtst/resolve/main\`
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>We use the deep model PatchTST for prediction, which is a transformer-based temporal prediction model with excellent performance in long time series prediction tasks.</p><h4 id="step-3-model-inference-1" tabindex="-1"><a class="header-anchor" href="#step-3-model-inference-1"><span>Step 3: Model Inference</span></a></h4><div class="language-Shell line-numbers-mode" data-ext="Shell" data-title="Shell"><pre class="language-Shell"><code>IoTDB&gt; select * from root.eg.voltage limit 96
+-----------------------------+------------------+------------------+------------------+
| Time|root.eg.voltage.s0|root.eg.voltage.s1|root.eg.voltage.s2|
+-----------------------------+------------------+------------------+------------------+
|2023-02-14T20:38:32.000+08:00| 2038.0| 2028.0| 2041.0|
|2023-02-14T20:38:38.000+08:00| 2014.0| 2005.0| 2018.0|
|2023-02-14T20:38:44.000+08:00| 2014.0| 2005.0| 2018.0|
......
|2023-02-14T20:47:52.000+08:00| 2024.0| 2016.0| 2027.0|
|2023-02-14T20:47:57.000+08:00| 2024.0| 2016.0| 2027.0|
|2023-02-14T20:48:03.000+08:00| 2024.0| 2016.0| 2027.0|
+-----------------------------+------------------+------------------+------------------+
Total line number = 96
IoTDB&gt; call inference(patchtst, &quot;select s0,s1,s2 from root.eg.voltage&quot;, window=head(96))
+---------+---------+---------+
| output0| output1| output2|
+---------+---------+---------+
|2013.4113|2011.2539|2010.2732|
|2013.2792| 2007.902|2035.7709|
|2019.9114|2011.0453|2016.5848|
......
|2018.7078|2009.7993|2017.3502|
|2033.9062|2010.2087|2018.1757|
|2022.2194| 2011.923|2020.5442|
|2022.1393|2023.4688|2020.9344|
+---------+---------+---------+
Total line number = 48
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Comparing the predicted results of the C-phase voltage with the real results, we can get the following image.</p><p>The data before 01/25 14:33 is the past data input to the model, the yellow line after 01/25 14:33 is the predicted C-phase voltage given by the model, and the blue colour is the actual A-phase voltage data in the dataset (used for comparison).</p><figure><img src="https://alioss.timecho.com/docs/img/s5.png" alt="" tabindex="0" loading="lazy"><figcaption></figcaption></figure><p>It can be seen that we have used the data of the last 8 minutes of voltage to model the possible changes in the A-phase voltage for the next 4 minutes based on the inter-relationships between the sequences learned earlier, and it can be seen that the predicted curves and the actual results maintain a high degree of synchronicity in terms of trends after visualisation.</p><h3 id="_6-3-anomaly-detection" tabindex="-1"><a class="header-anchor" href="#_6-3-anomaly-detection"><span>6.3 Anomaly Detection</span></a></h3><p>In the civil aviation and transport industry, there exists a need for anomaly detection of the number of passengers travelling on an aircraft. The results of anomaly detection can be used to guide the adjustment of flight scheduling to make the organisation more efficient.</p>`,16),ie={href:"https://alioss.timecho.com/docs/img/airline.csv",target:"_blank",rel:"noopener noreferrer"},te=e("br",null,null,-1),ae=a(`<h4 id="step-1-data-import-2" tabindex="-1"><a class="header-anchor" href="#step-1-data-import-2"><span>Step 1: Data Import</span></a></h4><p>Users can import the dataset using <code>import-csv.sh</code> in the tools folder</p><p><code>Bash bash . /import-csv.sh -h 127.0.0.1 -p 6667 -u root -pw root -f ... /... /data.csv </code></p><h4 id="step-2-model-inference" tabindex="-1"><a class="header-anchor" href="#step-2-model-inference"><span>Step 2: Model Inference</span></a></h4><p>IoTDB has some built-in machine learning algorithms that can be used directly, a sample prediction using one of the anomaly detection algorithms is shown below:</p><div class="language-Shell line-numbers-mode" data-ext="Shell" data-title="Shell"><pre class="language-Shell"><code>IoTDB&gt; select * from root.eg.airline
+-----------------------------+------------------+
| Time|root.eg.airline.s0|
+-----------------------------+------------------+
|1949-01-31T00:00:00.000+08:00| 224.0|
|1949-02-28T00:00:00.000+08:00| 118.0|
|1949-03-31T00:00:00.000+08:00| 132.0|
|1949-04-30T00:00:00.000+08:00| 129.0|
......
|1960-09-30T00:00:00.000+08:00| 508.0|
|1960-10-31T00:00:00.000+08:00| 461.0|
|1960-11-30T00:00:00.000+08:00| 390.0|
|1960-12-31T00:00:00.000+08:00| 432.0|
+-----------------------------+------------------+
Total line number = 144
IoTDB&gt; call inference(_Stray, &quot;select s0 from root.eg.airline&quot;, k=2)
+-------+
|output0|
+-------+
| 0|
| 0|
| 0|
| 0|
......
| 1|
| 1|
| 0|
| 0|
| 0|
| 0|
+-------+
Total line number = 144
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>We plot the results detected as anomalies to get the following image. Where the blue curve is the original time series and the time points specially marked with red dots are the time points that the algorithm detects as anomalies.</p><figure><img src="https://alioss.timecho.com/docs/img/s6.png" alt="" tabindex="0" loading="lazy"><figcaption></figcaption></figure><p>It can be seen that the Stray model has modelled the input sequence changes and successfully detected the time points where anomalies occur.</p>`,9);function se(le,oe){const l=s("RouteLink"),t=s("ExternalLinkIcon");return d(),r("div",null,[u,e("p",null,[n("The deployment of AINode can be found in the document "),i(l,{to:"/UserGuide/latest/Deployment-and-Maintenance/Deployment-Guide_timecho.html#AINode-%E9%83%A8%E7%BD%B2"},{default:c(()=>[n("Deployment Guidelines")]),_:1}),n(" .")]),h,e("ul",null,[p,e("li",null,[e("p",null,[n("uri: resource path to the model registration file, which should contain the "),e("strong",null,[n("model weights "),e("a",v,[n("model.pt"),i(t)]),n(" file and the model's metadata description file config.yaml")]),n(".")]),g])]),b,f,e("p",null,[n("In the current example folder, it contains "),e("a",_,[n("model.pt"),i(t)]),n(" and config.yaml files, "),e("a",w,[n("model.pt"),i(t)]),n(" is the training get, and the content of config.yaml is as follows:")]),T,e("table",null,[y,e("tbody",null,[e("tr",null,[I,S,x,e("td",null,[e("a",L,[n("Arima Parameter description"),i(t)])])]),e("tr",null,[A,M,k,e("td",null,[e("a",D,[n("STLForecaster Parameter description"),i(t)])])]),e("tr",null,[N,B,E,e("td",null,[e("a",Q,[n("NaiveForecaster Parameter description"),i(t)])])]),e("tr",null,[q,C,P,e("td",null,[e("a",U,[n("ExponentialSmoothing 参Parameter description"),i(t)])])]),e("tr",null,[F,R,O,e("td",null,[e("a",z,[n("GaussianHMMParameter description"),i(t)])])]),e("tr",null,[G,V,W,e("td",null,[e("a",H,[n("GMMHMM参数说明"),i(t)])])]),e("tr",null,[Y,Z,J,e("td",null,[e("a",j,[n("Stray Parameter description"),i(t)])])])])]),K,e("p",null,[n("The data for the test set of ETTh1 that we use is "),e("a",X,[n("ETTh1"),i(t)]),n(".")]),$,e("p",null,[n("The test set data content is "),e("a",ee,[n("data"),i(t)]),n(".")]),ne,e("p",null,[n("Airline Passengers is a time-series dataset that records the number of international air passengers between 1949 and 1960, sampled at one-month intervals. The dataset contains a total of one time series. The dataset is "),e("a",ie,[n("airline"),i(t)]),n("."),te,n(" On this dataset, the model inference function of IoTDB-ML can empower the transport industry by capturing the changing patterns of the sequence in order to detect anomalies at the sequence time points.")]),ae])}const re=o(m,[["render",se],["__file","AINode_timecho.html.vue"]]),ce=JSON.parse('{"path":"/UserGuide/latest/User-Manual/AINode_timecho.html","title":"AINode(Machine Learning Framework)","lang":"en-US","frontmatter":{"description":"AINode(Machine Learning Framework) AINode is the third internal node after ConfigNode and DataNode in Apache IoTDB, which extends the capability of machine learning analysis of ...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://iotdb.apache.org/zh/UserGuide/latest/User-Manual/AINode_timecho.html"}],["meta",{"property":"og:url","content":"https://iotdb.apache.org/UserGuide/latest/User-Manual/AINode_timecho.html"}],["meta",{"property":"og:site_name","content":"IoTDB Website"}],["meta",{"property":"og:title","content":"AINode(Machine Learning Framework)"}],["meta",{"property":"og:description","content":"AINode(Machine Learning Framework) AINode is the third internal node after ConfigNode and DataNode in Apache IoTDB, which extends the capability of machine learning analysis of ..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:image","content":"https://alioss.timecho.com/upload/AInode1.png"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-02-07T02:18:48.000Z"}],["meta",{"property":"article:modified_time","content":"2024-02-07T02:18:48.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"AINode(Machine Learning Framework)\\",\\"image\\":[\\"https://alioss.timecho.com/upload/AInode1.png\\",\\"https://alioss.timecho.com/docs/img/s1.png\\",\\"https://alioss.timecho.com/docs/img/s2.png\\",\\"https://alioss.timecho.com/docs/img/s3.png\\",\\"https://alioss.timecho.com/docs/img/s4.png\\",\\"https://alioss.timecho.com/docs/img/s5.png\\",\\"https://alioss.timecho.com/docs/img/s6.png\\"],\\"dateModified\\":\\"2024-02-07T02:18:48.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":2,"title":"1. Advantageous features","slug":"_1-advantageous-features","link":"#_1-advantageous-features","children":[]},{"level":2,"title":"2. Basic Concepts","slug":"_2-basic-concepts","link":"#_2-basic-concepts","children":[]},{"level":2,"title":"3. Installation and Deployment","slug":"_3-installation-and-deployment","link":"#_3-installation-and-deployment","children":[]},{"level":2,"title":"4. Usage Guidelines","slug":"_4-usage-guidelines","link":"#_4-usage-guidelines","children":[{"level":3,"title":"4.1 Registering Models","slug":"_4-1-registering-models","link":"#_4-1-registering-models","children":[]},{"level":3,"title":"4.2 Viewing Models","slug":"_4-2-viewing-models","link":"#_4-2-viewing-models","children":[]},{"level":3,"title":"4.3 Delete Model","slug":"_4-3-delete-model","link":"#_4-3-delete-model","children":[]},{"level":3,"title":"4.4 Using Built-in Model Reasoning","slug":"_4-4-using-built-in-model-reasoning","link":"#_4-4-using-built-in-model-reasoning","children":[]},{"level":3,"title":"4.5 Reasoning with Deep Learning Models","slug":"_4-5-reasoning-with-deep-learning-models","link":"#_4-5-reasoning-with-deep-learning-models","children":[]}]},{"level":2,"title":"5. Privilege Management","slug":"_5-privilege-management","link":"#_5-privilege-management","children":[]},{"level":2,"title":"6. Practical Examples","slug":"_6-practical-examples","link":"#_6-practical-examples","children":[{"level":3,"title":"6.1 Power Load Prediction","slug":"_6-1-power-load-prediction","link":"#_6-1-power-load-prediction","children":[]},{"level":3,"title":"6.2 Power Prediction","slug":"_6-2-power-prediction","link":"#_6-2-power-prediction","children":[]},{"level":3,"title":"6.3 Anomaly Detection","slug":"_6-3-anomaly-detection","link":"#_6-3-anomaly-detection","children":[]}]}],"git":{"createdTime":1704854860000,"updatedTime":1707272328000,"contributors":[{"name":"wanghui42","email":"105700158+wanghui42@users.noreply.github.com","commits":2}]},"readingTime":{"minutes":15.63,"words":4690},"filePathRelative":"UserGuide/latest/User-Manual/AINode_timecho.md","localizedDate":"January 10, 2024","autoDesc":true}');export{re as comp,ce as data};