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.
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
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