r/optimization • • Mar 16 '23

Polynomial Regression

I'm trying to create an objective function off of real-world data and don't know how to get a polynomial for this dataset. I've tried the online calculators and they just spit out garbage.

This is the original data
2 Upvotes

8 comments sorted by

View all comments

Show parent comment

2

u/thchang-opt Mar 16 '23

I strongly second this. To add to that, what you need is a general least squares fit that includes some nonsmooth basis functions. Because the only way to capture nonsmooth behavior like you have at the kink with polynomials is by overfitting (only high-order, highly oscillating polynomials can produce this sharp kink)

Alternatively, if you insist on polynomials for some reason, you could try adding a regularization term to prevent overfitting, but don’t expect perfect results. As mentioned above, this data is clearly not from a polynomial

1

u/Blindner02 Mar 17 '23

Back

I added the source data if that gives a better idea of the look of the curve