This is an automated email from the ASF dual-hosted git repository.

hui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new a5167ac654 Update Data-Repairing.md (#8852)
a5167ac654 is described below

commit a5167ac65495f9bed0b70ba6e15210bf384f95f3
Author: BytesChen <[email protected]>
AuthorDate: Fri Jan 13 15:24:44 2023 +0800

    Update Data-Repairing.md (#8852)
    
    Co-authored-by: czj-147 <[email protected]>
---
 .../Operators-Functions/Data-Repairing.md          | 104 +++++++++++++++++++++
 .../Operators-Functions/Data-Repairing.md          | 102 ++++++++++++++++++++
 2 files changed, 206 insertions(+)

diff --git a/docs/UserGuide/Operators-Functions/Data-Repairing.md 
b/docs/UserGuide/Operators-Functions/Data-Repairing.md
index 2c1740e0c7..67e08cf8b5 100644
--- a/docs/UserGuide/Operators-Functions/Data-Repairing.md
+++ b/docs/UserGuide/Operators-Functions/Data-Repairing.md
@@ -413,4 +413,108 @@ Output series:
 |2021-07-01T12:01:09.000+08:00|                                                
                                       1705|
 |2021-07-01T12:01:10.000+08:00|                                                
                                       1706|
 
+-----------------------------+-------------------------------------------------------------------------------------------+
+```
+
+## SeasonalRepair
+
+### Usage
+This function is used to repair the value of the seasonal time series via 
decomposition. Currently, two methods are supported: **Classical** - detect 
irregular fluctuations through residual component decomposed by classical 
decomposition, and repair them through moving average;  **Improved** - detect 
irregular fluctuations through residual component decomposed by improved 
decomposition, and repair them through moving median.
+
+**Name:** SEASONALREPAIR
+
+**Input Series:** Only support a single input series. The data type is INT32 / 
INT64 / FLOAT / DOUBLE.
+
+**Parameters:**
+
++ `method`: The decomposition method used to repair, which is 'Classical' or 
'Improved'. By default, classical decomposition is used.
++ `period`: It is the period of  the time series.
++ `k`: It is the range threshold of residual term, which limits the degree to 
which the residual term is off-center. By default, it is 9.
++ `max_iter`: It is the maximum number of iterations for the algorithm. By 
default, it is 10.
+
+**Output Series:** Output a single series. The type is the same as the input. 
This series is the input after repairing.
+
+**Note:** `NaN` will be filled with linear interpolation before repairing.
+
+### Examples
+
+#### Repair with Classical
+
+When `method` is 'Classical' or default value, classical decomposition method 
is used. 
+
+Input series:
+
+```
++-----------------------------+---------------+
+|                         Time|root.test.d2.s1|
++-----------------------------+---------------+
+|2020-01-01T00:00:02.000+08:00|          100.0|
+|2020-01-01T00:00:04.000+08:00|          120.0|
+|2020-01-01T00:00:06.000+08:00|           80.0|
+|2020-01-01T00:00:08.000+08:00|          100.5|
+|2020-01-01T00:00:10.000+08:00|          119.5|
+|2020-01-01T00:00:12.000+08:00|          101.0|
+|2020-01-01T00:00:14.000+08:00|           99.5|
+|2020-01-01T00:00:16.000+08:00|          119.0|
+|2020-01-01T00:00:18.000+08:00|           80.5|
+|2020-01-01T00:00:20.000+08:00|           99.0|
+|2020-01-01T00:00:22.000+08:00|          121.0|
+|2020-01-01T00:00:24.000+08:00|           79.5|
++-----------------------------+---------------+
+```
+
+SQL for query:
+
+```sql
+select seasonalrepair(s1,'period'=3,'k'=2) from root.test.d2
+```
+
+Output series:
+
+```
++-----------------------------+--------------------------------------------------+
+|                         Time|seasonalrepair(root.test.d2.s1, 'period'=4, 
'k'=2)|
++-----------------------------+--------------------------------------------------+
+|2020-01-01T00:00:02.000+08:00|                                             
100.0|
+|2020-01-01T00:00:04.000+08:00|                                             
120.0|
+|2020-01-01T00:00:06.000+08:00|                                              
80.0|
+|2020-01-01T00:00:08.000+08:00|                                             
100.5|
+|2020-01-01T00:00:10.000+08:00|                                             
119.5|
+|2020-01-01T00:00:12.000+08:00|                                              
87.0|
+|2020-01-01T00:00:14.000+08:00|                                              
99.5|
+|2020-01-01T00:00:16.000+08:00|                                             
119.0|
+|2020-01-01T00:00:18.000+08:00|                                              
80.5|
+|2020-01-01T00:00:20.000+08:00|                                              
99.0|
+|2020-01-01T00:00:22.000+08:00|                                             
121.0|
+|2020-01-01T00:00:24.000+08:00|                                              
79.5|
++-----------------------------+--------------------------------------------------+
+```
+
+#### Repair with Improved
+When `method` is 'Improved', improved decomposition method is used.
+
+Input series is the same as above, the SQL for query is shown below:
+
+```sql
+select seasonalrepair(s1,'method'='improved','period'=3) from root.test.d2
+```
+
+Output series:
+
+```
++-----------------------------+-------------------------------------------------------------+
+|                         Time|valuerepair(root.test.d2.s1, 
'method'='improved', 'period'=3)|
++-----------------------------+-------------------------------------------------------------+
+|2020-01-01T00:00:02.000+08:00|                                                
        100.0|
+|2020-01-01T00:00:04.000+08:00|                                                
        120.0|
+|2020-01-01T00:00:06.000+08:00|                                                
         80.0|
+|2020-01-01T00:00:08.000+08:00|                                                
        100.5|
+|2020-01-01T00:00:10.000+08:00|                                                
        119.5|
+|2020-01-01T00:00:12.000+08:00|                                                
         81.5|
+|2020-01-01T00:00:14.000+08:00|                                                
         99.5|
+|2020-01-01T00:00:16.000+08:00|                                                
        119.0|
+|2020-01-01T00:00:18.000+08:00|                                                
         80.5|
+|2020-01-01T00:00:20.000+08:00|                                                
         99.0|
+|2020-01-01T00:00:22.000+08:00|                                                
        121.0|
+|2020-01-01T00:00:24.000+08:00|                                                
         79.5|
++-----------------------------+-------------------------------------------------------------+
 ```
\ No newline at end of file
diff --git a/docs/zh/UserGuide/Operators-Functions/Data-Repairing.md 
b/docs/zh/UserGuide/Operators-Functions/Data-Repairing.md
index 0ddb9a54d2..fe555d0c64 100644
--- a/docs/zh/UserGuide/Operators-Functions/Data-Repairing.md
+++ b/docs/zh/UserGuide/Operators-Functions/Data-Repairing.md
@@ -405,4 +405,106 @@ select MasterRepair(t1,t2,t3,m1,m2,m3) from root.test
 |2021-07-01T12:01:09.000+08:00|                                                
                                       1705|
 |2021-07-01T12:01:10.000+08:00|                                                
                                       1706|
 
+-----------------------------+-------------------------------------------------------------------------------------------+
+```
+
+## SeasonalRepair
+
+### 函数简介
+本函数用于对周期性时间序列的数值进行基于分解的修复。目前,本函数支持两种方法:**Classical**使用经典分解方法得到的残差项检测数值的异常波动,并使用滑动平均修复序列;**Improved**使用改进的分解方法得到的残差项检测数值的异常波动,并使用滑动中值修复序列。
+
+**函数名:** SEASONALREPAIR
+
+**输入序列:** 仅支持单个输入序列,类型为 INT32 / INT64 / FLOAT / DOUBLE。
+
+**参数:** 
+
++ `method`:修复时采用的分解方法,取值为'Classical'或'Improved'。在缺省情况下,使用经典分解方法进行修复。
++ `period`:序列的周期。
++ `k`:残差项的范围阈值,用来限制残差项偏离中心的程度。在缺省情况下为9。
++ `max_iter`:算法的最大迭代次数。在缺省情况下为10。
+
+**输出序列:** 输出单个序列,类型与输入序列相同。该序列是修复后的输入序列。
+
+**提示:** 输入序列中的`NaN`在修复之前会先进行线性插值填补。
+
+### 使用示例
+#### 使用经典分解方法进行修复
+当`method`缺省或取值为'Classical'时,本函数将使用经典分解方法进行数值修复。
+
+输入序列:
+
+```
++-----------------------------+---------------+
+|                         Time|root.test.d2.s1|
++-----------------------------+---------------+
+|2020-01-01T00:00:02.000+08:00|          100.0|
+|2020-01-01T00:00:04.000+08:00|          120.0|
+|2020-01-01T00:00:06.000+08:00|           80.0|
+|2020-01-01T00:00:08.000+08:00|          100.5|
+|2020-01-01T00:00:10.000+08:00|          119.5|
+|2020-01-01T00:00:12.000+08:00|          101.0|
+|2020-01-01T00:00:14.000+08:00|           99.5|
+|2020-01-01T00:00:16.000+08:00|          119.0|
+|2020-01-01T00:00:18.000+08:00|           80.5|
+|2020-01-01T00:00:20.000+08:00|           99.0|
+|2020-01-01T00:00:22.000+08:00|          121.0|
+|2020-01-01T00:00:24.000+08:00|           79.5|
++-----------------------------+---------------+
+```
+
+用于查询的SQL语句:
+
+```sql
+select seasonalrepair(s1,'period'=3,'k'=2) from root.test.d2
+```
+
+输出序列:
+
+```
++-----------------------------+--------------------------------------------------+
+|                         Time|seasonalrepair(root.test.d2.s1, 'period'=4, 
'k'=2)|
++-----------------------------+--------------------------------------------------+
+|2020-01-01T00:00:02.000+08:00|                                             
100.0|
+|2020-01-01T00:00:04.000+08:00|                                             
120.0|
+|2020-01-01T00:00:06.000+08:00|                                              
80.0|
+|2020-01-01T00:00:08.000+08:00|                                             
100.5|
+|2020-01-01T00:00:10.000+08:00|                                             
119.5|
+|2020-01-01T00:00:12.000+08:00|                                              
87.0|
+|2020-01-01T00:00:14.000+08:00|                                              
99.5|
+|2020-01-01T00:00:16.000+08:00|                                             
119.0|
+|2020-01-01T00:00:18.000+08:00|                                              
80.5|
+|2020-01-01T00:00:20.000+08:00|                                              
99.0|
+|2020-01-01T00:00:22.000+08:00|                                             
121.0|
+|2020-01-01T00:00:24.000+08:00|                                              
79.5|
++-----------------------------+--------------------------------------------------+
+```
+
+#### 使用改进的分解方法进行修复
+当`method`取值为'Improved'时,本函数将使用改进的分解方法进行数值修复。
+
+输入序列同上,用于查询的SQL语句如下:
+
+```sql
+select seasonalrepair(s1,'method'='improved','period'=3) from root.test.d2
+```
+
+输出序列:
+
+```
++-----------------------------+-------------------------------------------------------------+
+|                         Time|valuerepair(root.test.d2.s1, 
'method'='improved', 'period'=3)|
++-----------------------------+-------------------------------------------------------------+
+|2020-01-01T00:00:02.000+08:00|                                                
        100.0|
+|2020-01-01T00:00:04.000+08:00|                                                
        120.0|
+|2020-01-01T00:00:06.000+08:00|                                                
         80.0|
+|2020-01-01T00:00:08.000+08:00|                                                
        100.5|
+|2020-01-01T00:00:10.000+08:00|                                                
        119.5|
+|2020-01-01T00:00:12.000+08:00|                                                
         81.5|
+|2020-01-01T00:00:14.000+08:00|                                                
         99.5|
+|2020-01-01T00:00:16.000+08:00|                                                
        119.0|
+|2020-01-01T00:00:18.000+08:00|                                                
         80.5|
+|2020-01-01T00:00:20.000+08:00|                                                
         99.0|
+|2020-01-01T00:00:22.000+08:00|                                                
        121.0|
+|2020-01-01T00:00:24.000+08:00|                                                
         79.5|
++-----------------------------+-------------------------------------------------------------+
 ```
\ No newline at end of file

Reply via email to