Daily Dose of Data Science

Share this post

Polynomial Linear Regression with NumPy

www.blog.dailydoseofds.com

Polynomial Linear Regression with NumPy

Avi Chawla
Oct 15, 2022
1
Share

Polynomial linear regression using Sklearn is tedious as one has to explicitly code its features. This can get challenging when one has to iteratively build higher-degree polynomial models.

NumPy's 𝐩𝐨π₯𝐲𝐟𝐒𝐭() method is an excellent alternative to this. Here, you can specify the degree of the polynomial as a parameter. As a result, it automatically creates the corresponding polynomial features.

The downside is that you cannot add custom features such as trigonometric/logarithmic. In other words, you are restricted to only polynomial features. But if that is not your requirement, NumPy's 𝐩𝐨π₯𝐲𝐟𝐒𝐭() method can be a better approach.

Read more here: https://numpy.org/doc/stable/reference/generated/numpy.polyfit.html

Thanks for reading Daily Dose of Data Science! Subscribe for free to learn something new and insightful about Python and Data Science every day. Also, get a Free Data Science PDF (250+ pages) with 200+ tips.


P.S. I post these daily tips on LinkedIn as well. You can read them here:Β https://www.linkedin.com/in/avi-chawla/recent-activity/shares

1
Share
Previous
Next
Comments
Top
New
Community

No posts

Ready for more?

Β© 2023 Avi Chawla
Privacy βˆ™ Terms βˆ™ Collection notice
Start WritingGet the app
SubstackΒ is the home for great writing