Troubles with linear regression

Using InfluxDB 2.1.1 on Linux

I am trying to use the statsmodels.linearRegression() function. The problem I am currently struggling with is that the groupings are not considered.

Here is the script:

import "contrib/anaisdg/statsmodels"
original = from(bucket: "my_bucket")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "aht")
  |> filter(fn: (r) => r["_field"] == "mean" and r._value > 0)
  |> group(columns: ["application"]) // <-- group by application tag
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)

original |> yield(name: "original")

|> statsmodels.linearRegression()
|> yield(name: "lr")

The problem is: the values y_hat do not consider the groups, the linear regression seems to be calculated only for the first group (helpdesk), the values for other groups (ivr, serfselrvice) seems to be ignored.

Maybe I’m doing something wrong?

I have this same Error currently, I was talking with the creator of the function yesterday, 3/21, they are working on this, it is supposed to evaluate each table individually.

Thanks, is there a corresponding bug ticket? I’ve found nothing…

Hello @vladi and @wood2944 I’m poking some flux engineers again. Hopefully they have some time. I’ll let you know. For now you’ll have to apply to each series individually. :frowning:

@vladi and @wood2944,
It should be working now: