[WIP] Implementing Averaged SGD

Working on implementing averaged SGD for both classifier and regressor for #543
Please put `const` on the pointers. I know it doesn't matter for the generated code, but it helps in distinguishing input and output parameters.