Adding linear regression and refactoring Ridge regression to use SGD

Based on mesos/spark #830 contributed by @etrain. In addition to that pull request this includes a new unit test for ridge regression, centering variables before training in Lasso, Ridge and some minor style fixes.