0
$\begingroup$

I'm trying to fit either a straight line or 2nd degree polynomial through many sets of points (2-dimensional data). I would much prefer a straight line over a polynomial, so am trying to penalize the 2nd degree coefficient. This reminds me of L1 regularization which can be used as a penalty on coefficients and also perform feature selection. However, I only want the penalty to apply for the 2nd degree, in order to favor straight line fits. Is there a way to tweak sklearn or apply some other python package to get this result?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.