# SQL feature engineering + XGBoost (.4026 private LB, 1/2 of #100 solution)

[https://github.com/happycube/kaggle2017/tree/master/instacart](https://github.com/happycube/kaggle2017/tree/master/instacart)
This isn't much compared to sjv's #3 code post*, but I'll share what I've got anyway :)  It's a pretty basic model using features I generated largely based on Sh1ng's kernel, with some new features that handle departments like they were products (marginally useful) - the new thing is the use of SQL queries etc to run the feature engineering.
I started with SQLite but needed arrays and aggregate functions, which led me to set up Postgres for the first time.  I'm completely new at it, so it's not as idiomatic and elegant as it could be, but I'm still pretty proud of it as a first project, and it fills in a hole in my knowledge a bit.
Hope you find something useful here, especially for those reading this after the next competition with relational data comes up :)
(* - I wasn't expecting a medal at all, being #277 on the public LB - but I was still planning to post anyway!)