Linear Regression :: Kloudfuse Docs

Linear Regression

Linear regression predicts the value of a dependent variable from the value of an independent variable. It models the relationship between the variables as a linear equation, and fits a line that minimizes the differences between the predicted and actual values.

Parameters

Sampling interval: Sampling intervals are 1m, 2m, 3m, 5m, 10m, 15m, 30m, 1h, and 2h.

Numeric parameter: Has the possible values of 1, 2, or 3.

How it works

The function fits a least-squares line through each series' samples in the range window, then extends that line the requested number of seconds past the evaluation time. The extrapolated point is the predicted value — which makes it the classic early-warning alert: fire when a value will cross a threshold, not when it already has.

In Dashboards

To use linear regression in a dashboard, apply the following function:

predict_linear( \
  ${promql} \ (1)
  ${prediction_in_seconds} \(2)
)
1 ${promql}: PromQL query to evaluate
2 ${prediction_in_seconds}: Predicts the value of a time series the specified number of seconds in the future.

For the operator reference — syntax, parameters, and a validated example — see predict_linear in the PromQL documentation.

Limitations

Next steps

For an in-depth discussion of linear-regression, see these external resources: