-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Fix moving function linear weighted avg #118516
Fix moving function linear weighted avg #118516
Conversation
Pinging @elastic/es-analytical-engine (Team:Analytics) |
@elasticmcahine, test this please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Quentin18! I've kicked this off with the robots and will get back to you. I imagine there might be a test failure, but the robots will find it.
@elasticmachine, test this please. |
Looks like I do that myself. |
@elasticsearchmachine, test this please |
@elasticmachine test this please |
I've pushed a few test fixes that ought to make the robots happy. It's an integration test, and it's forwards and backwards compatibility form. @elasticsearchmachine, test this please. |
@elasticmachine test this please |
I have a spelling problem calling the right robot.... |
@elasticmachine test this please I had to merge main in. Again. BWC tests were sad. |
Ok robot, are you going to make backport commits or should I? |
💔 Backport failed
You can use sqren/backport to manually backport by running |
Ok robot. Monday, monday. |
@nik9000 I will take care of the backports |
Fix moving function linear weighted avg # Conflicts: # modules/aggregations/build.gradle
Fix moving function linear weighted avg Co-authored-by: Quentin Deschamps <[email protected]>
) Fix moving function linear weighted avg Co-authored-by: Quentin Deschamps <[email protected]> # Conflicts: # server/src/main/java/org/elasticsearch/rest/action/search/SearchCapabilities.java
Fix moving function linear weighted avg Co-authored-by: Quentin Deschamps <[email protected]> # Conflicts: # server/src/main/java/org/elasticsearch/rest/action/search/SearchCapabilities.java
) Fix moving function linear weighted avg Co-authored-by: Quentin Deschamps <[email protected]>
Closes #113751
There is a problem in the
MovingFunctions.linearWeightedAvg
method. ThetotalWeight
is initialized to 1 whereas it should be initialized to 0.In the issue example, the raw values are:
Actually, the Linear Weighted Moving Average (LWMA) is calculated as follows:
Where$v=\{15.3984375, 15.3984375, 15.703125\}$ and $w=\{1, 2, 3\}$ . The extra 1 in the denominator is due to the wrong initialization. In the example:
The LWMA formula should be:
In the example: