Implementing polynoming regression?

How to do we implement polynomial regression?
Does it use this code part from the lab:
lin_model(degree)
or does it use
PolynomialFeatures

Hello @Adveat_Prasad_Karnik

I think you are talking about the Course 2 Week 3 assignment.

There are two independent steps:

1. model

degree = 10
lmodel = lin_model(degree)
lmodel.fit(X_train, y_train)

lin_model instantiate a model, and lmodel.fit trains the model with the data (X_train, y_train).

2. data

If your data has polynomial features, then the model is a polynomial regression model. To generate polynomial features, we can use, as you said, the PolynomialFeatures provided by sklearn.

Summary

So, if you apply PolynomialFeatures to your raw data, you can call the model learnt with that data a polynomial regression model.

Raymond

1 Like

I see.
Thank you so much for making things clearer for me!