Polynomial Linear Regression with NumPy
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
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


