boston housing dataset we already used polynomial features on this dataset in now let' have look at how these features were constructedand at how much the polynomial features help first we load the dataand rescale it to be between and using minmaxscalerin[ ]from sklearn datasets import load_boston from sklearn model_selection import train_test_split from sklearn preprocessing import minmaxscaler boston load_boston(x_trainx_testy_trainy_test train_test_split (boston databoston targetrandom_state= rescale data scaler minmaxscaler(x_train_scaled scaler fit_transform(x_trainx_test_scaled scaler transform(x_testnowwe extract polynomial features and interactions up to degree of in[ ]poly polynomialfeatures(degree= fit(x_train_scaledx_train_poly poly transform(x_train_scaledx_test_poly poly transform(x_test_scaledprint("x_train shape{}format(x_train shape)print("x_train_poly shape{}format(x_train_poly shape)out[ ]x_train shape( x_train_poly shape( the data originally had featureswhich were expanded into interaction features these new features represent all possible interactions between two different original featuresas well as the square of each original feature degree= here means that we look at all features that are the product of up to two original features the exact correspondence between input and output features can be found using the get_feature_names methodin[ ]print("polynomial feature names:\ {}format(poly get_feature_names())out[ ]polynomial feature names[' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ^ '' '' '' '' '' '' '' '' '' '' '' '' '' ^ '' ' representing data and engineering features