Jump to content

# Fit polynomial curve

## Recommended Posts

I need to accomplish following things:

- Bin the x-axis

- Span the y-axis for each bin (max-min)

- Filter outliers based on quantiles

- Finally I would want to fit some polynomial curve based on max and min values of the span (join the mid values in each bin)

But I cant find appropriate way to do it

Edited by Tranquil Oshan
Question was not complete
##### Share on other sites

• Seeq Team

Hi Tranquil Oshan,

I have a workaround but as you can see from the below steps, it may not be the best either. Can you share with me what you hope to achieve with this polynomial fitting of min and max? , maybe there's another way we can approach this if i can understand your objective.

Step 1 : Create the binning condition using value search. In this example I have 8 conditions with the bin size of 5.

Step 2 : Calculate Max and Min value during each bin.

```combinewith(
\$t.aggregate(maxValue(),\$a.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(maxValue(),\$b.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(maxValue(),\$c.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(maxValue(),\$d.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(maxValue(),\$e.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(maxValue(),\$f.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(maxValue(),\$g.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(maxValue(),\$h.removeLongerThan(5d),startkey(),0s))```

```combinewith(
\$t.aggregate(minValue(),\$a.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(minValue(),\$b.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(minValue(),\$c.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(minValue(),\$d.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(minValue(),\$e.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(minValue(),\$f.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(minValue(),\$g.removeLongerThan(5d),startkey(),0s),
\$t.aggregate(minValue(),\$h.removeLongerThan(5d),startkey(),0s))```

Step 3 : Create the X-axis using setProperty() function with the 'bin' as value, corresponding to the Max value.

```combinewith(
\$t.aggregate(maxValue(),\$a.removeLongerThan(5d),startKey(),0s).toCapsules().setProperty('Bin',5),
\$t.aggregate(maxValue(),\$b.removeLongerThan(5d),startKey(),0s).toCapsules().setProperty('Bin',10),
\$t.aggregate(maxValue(),\$c.removeLongerThan(5d),startKey(),0s).toCapsules().setProperty('Bin',15),
\$t.aggregate(maxValue(),\$d.removeLongerThan(5d),startKey(),0s).toCapsules().setProperty('Bin',20),
\$t.aggregate(maxValue(),\$e.removeLongerThan(5d),startKey(),0s).toCapsules().setProperty('Bin',25),
\$t.aggregate(maxValue(),\$f.removeLongerThan(5d),startKey(),0s).toCapsules().setProperty('Bin',30),
\$t.aggregate(maxValue(),\$g.removeLongerThan(5d),startKey(),0s).toCapsules().setProperty('Bin',35),
\$t.aggregate(maxValue(),\$h.removeLongerThan(5d),startKey(),0s).toCapsules().setProperty('Bin',40))
.toSignal('Bin',startKey()).toDiscrete()```

Step 4 : Switch to the XY Plot.

Step 5 : Click on the f(x) button, Create a New Prediction for min and max polynomial.

Expand the training window. In this example the training window is set to 1 year (7/6/2022 11:26-6/9/2023 17:26).

Edited by Siti Tay

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now
×
×
• Create New...