Computer scienceData scienceInstrumentsScikit-learnTraining ML models with scikit-learnRegression in scikit-learn

Polynomial Regression with scikit-learn

Diabetes dataset

Report a typo

Train a polynomial regression model to predict the diabetes progression in patients based on their blood test results, age, gender, and BMI (body mass index).

To import the dataset from sklearn, run the following code:

from sklearn import datasets
diabetes = datasets.load_diabetes(as_frame=True, scaled = True)

X = diabetes.data
y = diabetes.target

The first 75% of the dataset will go to the train dataset, and the last 25% — to the test.

Train polynomial regression model with the following parameters:

poly = PolynomialFeatures(degree = 2, include_bias = True, interaction_only = False)

Compute the RMSE of the model on the test data. Use math.ceil() to round up to the nearest integer.

Enter a number
___

Create a free account to access the full topic