Skip to main content

Machine Learning

...About 1 min

Machine Learning



This function is used to learn the coefficients of the autoregressive models for a time series.

Name: AR

Input Series: Only support a single input numeric series. The type is INT32 / INT64 / FLOAT / DOUBLE.


  • p: The order of the autoregressive model. Its default value is 1.

Output Series: Output a single series. The type is DOUBLE. The first line corresponds to the first order coefficient, and so on.


  • Parameter p should be a positive integer.
  • Most points in the series should be sampled at a constant time interval.
  • Linear interpolation is applied for the missing points in the series.


Assigning Model Order

Input Series:

|                         Time|root.test.d0.s0|
|2020-01-01T00:00:01.000+08:00|           -4.0|
|2020-01-01T00:00:02.000+08:00|           -3.0|
|2020-01-01T00:00:03.000+08:00|           -2.0|
|2020-01-01T00:00:04.000+08:00|           -1.0|
|2020-01-01T00:00:05.000+08:00|            0.0|
|2020-01-01T00:00:06.000+08:00|            1.0|
|2020-01-01T00:00:07.000+08:00|            2.0|
|2020-01-01T00:00:08.000+08:00|            3.0|
|2020-01-01T00:00:09.000+08:00|            4.0|

SQL for query:

select ar(s0,"p"="2") from root.test.d0

Output Series:

|                         Time|ar(root.test.d0.s0,"p"="2")|
|1970-01-01T08:00:00.001+08:00|                     0.9429|
|1970-01-01T08:00:00.002+08:00|                    -0.2571|

Copyright © 2024 The Apache Software Foundation.
Apache and the Apache feather logo are trademarks of The Apache Software Foundation

Have a question? Connect with us on QQ, WeChat, or Slack. Join the community now.