Derivation and R code for feature hashing and model fitting via gradient descent