' '' '' ^ '' '' '' '' '' '' '' '' '' '' '' ^ '' '' '' '' '' '' '' '' '' '' ^ '' '' '' '' '' '' '' '' '' ^ '' '' '' '' '' '' '' '' ^ '' '' '' '' '' '' '' ^ '' '' '' '' '' '' ^ '' '' '' '' '' ^ '' '' '' '' ^ '' '' '' ^ '' '' ^ 'the first new feature is constant featurecalled " here the next features are the original features (called " to " "then follows the first feature squared (" ^ "and combinations of the first and the other features let' compare the performance using ridge on the data with and without interactionsin[ ]from sklearn linear_model import ridge ridge ridge(fit(x_train_scaledy_trainprint("score without interactions{ }formatridge score(x_test_scaledy_test))ridge ridge(fit(x_train_polyy_trainprint("score with interactions{ }formatridge score(x_test_polyy_test))out[ ]score without interactions score with interactions clearlythe interactions and polynomial features gave us good boost in performance when using ridge when using more complex model like random forestthe story is bit differentthoughin[ ]from sklearn ensemble import randomforestregressor rf randomforestregressor(n_estimators= fit(x_train_scaledy_trainprint("score without interactions{ }formatrf score(x_test_scaledy_test))rf randomforestregressor(n_estimators= fit(x_train_polyy_trainprint("score with interactions{ }format(rf score(x_test_polyy_test))out[ ]score without interactions score with interactions interactions and polynomials