Sometimes when building GLM models, you would like to configure GLM to search for higher order polynomial of the features .
The reason you may have to do is that, you may have strong predictors for a model and going for high order polynomial of predictors you will get higher accuracy.
With H2O, you can create higher order polynomials as below:
- Look for ‘interactions’ parameter in GLM model.
- In the interaction parameters add list of predictor columns to interact.
boston = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/gbm_test/BostonHousing.csv") predictors = boston.columns[:-1] response = "medv" from h2o.estimators.glm import H2OGeneralizedLinearEstimator interactions_list = ['crim', 'dis'] boston_glm = H2OGeneralizedLinearEstimator(interactions = interactions_list) boston_glm.train(x = predictors, y = response,training_frame = boston) boston_glm.coef()