docs-v2/content/flux/v0/stdlib/internal/promql/linearregression.md

2.1 KiB

title description menu weight
promql.linearRegression() function `promql.linearRegression()` implements linear regression functionality required to implement PromQL's [`deriv()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#deriv) and [`predict_linear()`](https://prometheus.io/docs/prometheus/latest/querying/functions/#predict_linear) functions.
flux_v0_ref
name parent identifier
promql.linearRegression internal/promql internal/promql/linearRegression
201

promql.linearRegression() implements linear regression functionality required to implement PromQL's deriv() and predict_linear() functions.

Important: The internal/promql package is not meant for external use.

Function type signature
(
    <-tables: stream[{A with _value: float, _time: time, _stop: time}],
    ?fromNow: float,
    ?predict: bool,
) => stream[{B with _value: float}]

{{% caption %}} For more information, see Function type signatures. {{% /caption %}}

Parameters

tables

Input data. Default is piped-forward data (<-).

predict

Output should contain a prediction.

fromNow

Time as a floating point value.