-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Linear regression by least squares method #1447
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
Linear regression by least squares method #1447
Conversation
|
👍 |
1 similar comment
|
👍 |
|
Would you be able to provide a test for that new method? |
|
@JeanFred Thank you for the advice. I have written a test. |
|
@JeanFred Thank you for the review. We heavily use graphite in our monitoring SaaS Mackerel for two years. @mechairoi he is in our team. This feature is very useful for us (and all users, of cource). We hope this pull request to be accepted. |
|
Thanks for writing this test @mechairoi! |
|
This is probably a dumb question, but does it make sense to default |
|
These arguments are copied from the Does it also make sense to default --- a/webapp/graphite/render/functions.py
+++ b/webapp/graphite/render/functions.py
@@ -2389,7 +2389,7 @@ def linearRegressionAnalysis(series):
offset = (sumII * sumV - sumIV * sumI) /denominator - factor * series.start
return factor, offset
-def linearRegression(requestContext, seriesList, startSourceAt, endSourceAt="now"):
+def linearRegression(requestContext, seriesList, startSourceAt=None, endSourceAt=None):
"""
Graphs the liner regression function by least squares method.
@@ -2407,8 +2407,8 @@ def linearRegression(requestContext, seriesList, startSourceAt, endSourceAt="now
"""
results = []
sourceContext = requestContext.copy()
- sourceContext['startTime'] = parseATTime(startSourceAt)
- sourceContext['endTime'] = parseATTime(endSourceAt)
+ if startSourceAt is not None: sourceContext['startTime'] = parseATTime(startSourceAt)
+ if endSourceAt is not None: sourceContext['endTime'] = parseATTime(endSourceAt) |
|
@obfuscurity Thank you for the review. I fixed default |
|
@obfuscurity @JeanFred |
|
@Songmu Looks good to me ; but still too junior to press the merge button :) |
|
@JeanFred do it :) |
|
All right, let’s do this then :) @mechairoi, would you be able to squash this? |
1af391c to
892c90f
Compare
|
@JeanFred squashed :) |
Linear regression by least squares method
|
Aaaaaaand done! |
|
😄 |
Added
leastSquaresForecastlinearRegressionfunction for graphs the liner regression by least squares method.