Add top-level methods for regression methods.
Also add multiple versions of them to make it easier to call them from java.
Rename package gradient to optimization