We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is your feature request related to a problem?
Adding a new PPL trendline command to support computing a moving averages of fields.
trendline
We would like to support two flavours of moving average:
SMA : Simple moving average
SMA(t) = (1/n) * Σ(f[i]), where i = t-n+1 to t
WMA : Weighted moving average
WMA(t) = Σ(w[i] * f[i]) / Σ(w[i]), where i = t-n+1 to t Where w[i] is the weight for the i-th data-point.
WMA(t) = Σ(w[i] * f[i]) / Σ(w[i]), where i = t-n+1 to t
In a typical WMA, the weights are linearly decreasing from the most recent to the oldest data-point: w[i] = n - (t - i), where i = t-n+1 to t
w[i] = n - (t - i), where i = t-n+1 to t
The complete forumlation would be: WMA(t) = Σ((n - (t - i)) * f[i]) / Σ(n - (t - i)), where i = t-n+1 to t
WMA(t) = Σ((n - (t - i)) * f[i]) / Σ(n - (t - i)), where i = t-n+1 to t
Example
The next command shows a trendline over a 5 month period events by month
source=t | stats count(date_month) | trendline sma(5, count) AS trend | fields trend
The next command would compute a 5-point simple moving average of the 'cpu_usage' field and store it in a new field called 'smooth_cpu'.
source=t| trendline sma(5,cpu_usage) as smooth_cpu
Multiple trendlines could be calculated in a single command, such as
| trendline sma(10,memory) as mem_trend wma(5,network_traffic) as net_trend.
The text was updated successfully, but these errors were encountered:
This issues and associated PRs covers Simple moving average (SMA) only. For WMA (Weighted moving average) see issue #831
Sorry, something went wrong.
No branches or pull requests
Is your feature request related to a problem?
Adding a new PPL
trendline
command to support computing a moving averages of fields.We would like to support two flavours of moving average:
SMA : Simple moving average
SMA(t) = (1/n) * Σ(f[i]), where i = t-n+1 to t
WMA : Weighted moving average
WMA(t) = Σ(w[i] * f[i]) / Σ(w[i]), where i = t-n+1 to t
Where w[i] is the weight for the i-th data-point.
In a typical WMA, the weights are linearly decreasing from the most recent to the oldest data-point:
w[i] = n - (t - i), where i = t-n+1 to t
The complete forumlation would be:
WMA(t) = Σ((n - (t - i)) * f[i]) / Σ(n - (t - i)), where i = t-n+1 to t
Example
The next command shows a trendline over a 5 month period events by month
The next command would compute a 5-point simple moving average of the 'cpu_usage' field and store it in a new field called 'smooth_cpu'.
Multiple trendlines could be calculated in a single command, such as
The text was updated successfully, but these errors were encountered: