Adjusted stepwise GAM

Use linear terms in the model if you don't have enough unique values.