-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new autoregression function: autoregress(lambda, offset, initial value) #65169
Conversation
This is an automated comment for commit c495be8 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
AST fuzzer reports an error:
The function I implemented only allow the lambda expression accept one argument of type Float64. The AST fuzzer gives two arguments to lambda expression. How shall I fix the AST fuzzer error? Is it okay that I check all arguments and throw BAD_ARGUMENT exception in case where input arguments violate the requirements of the function? |
@alexey-milovidov Is the document I wrote in the decription of the PR enough? According to the instruction, I wrote text for the function in the PR description, I think there would be a professional technical writer would translate it into a official document, is it right? |
@rschu1ze could you please give some instructions about wrting document. I am not sure if I need to write EN, RU, ZH documents. |
@nikitamikhaylov shall I write document in the PR? Is there any instructions for it? BTW, I noticed the failure of integration test "test_query_is_canceled_with_inf_retries", but it is not related to my PR. What should I do with it? Thank you. |
@Alex-Cheng I did not look at this PR yet but since it is implemented as a regular function, #60555 may apply. In other words: Does the AR model need to see the data in the entire column to work? If yes, then a regular function is not the right choice, a window function is.
About docs: docs/en/sql-reference/functions/time-series-functions.md would be the right place. Only English is mandatory, Russian and Chinese docs are optional. |
The autoregression is to look |
@Alex-Cheng The problem is that ClickHouse processes data based on independent chunks (blocks) of arbitrary size, controlled by setting |
I will think a way to implement the function that can work across data chunks. |
The code got quite a bit lot longer but I don't see how the problem (#65169 (comment)) was addressed. In fact, it is impossible to address in regular functions. I am afraid, you will need to implement the functionality as a window function. |
I plan to convert it to a draft PR. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Add new autoregression function: autoregress(lambda, offset, initial value). It implement feature request #64884.
Documentation entry for user-facing changes
Motivation
The Autoregressive (AR) model is a fundamental component in the realm of time series analysis and forecasting.
It is a kind of multiple regression method that uses the relationship between the observed value Yt and the observed values in previous periods to predict the value of Y. Among them, the dependent variable is the observed value Yt, and the independent variables are the lagged values of the dependent variable Yt-1, Yt-2,...
The steps of the autoregressive prediction method are as follows:
The syntax of the function is
autoregress(x->{expression}, backward_offset, initial_value)
. The example of usage for this function is:Parameters
T-n
result calculated previously, the argument specifies then
T-n
previous calculated result.CI Settings (Only check the boxes if you know what you are doing):