[WIP] Implementing Averaged SGD

Working on implementing averaged SGD for both classifier and regressor for #543
This might not be bad; if they're just pointers, they shouldn't slow
anything down, right? And I think they'd make the code logic much clearer.
My reflex would be to assign to `coef_` depending on the context, but in
retrospect that makes for much harder to read code.


On Thu, Jul 24, 2014 at 4:25 PM, Danny Sullivan <notifications@github.com>
wrote:

> In sklearn/linear_model/stochastic_gradient.py:
>
> > @@ -888,8 +898,15 @@ def decision_function(self, X):
> >             Predicted target values per element in X.
> >          """
> >          X = atleast2d_or_csr(X)
> > -        scores = safe_sparse_dot(X, self.coef_.T,
> > -                                 dense_output=True) + self.intercept_
> > +
> > +        if not self.avg:
> > +            # use the normal weights for scoring
> > +            scores = safe_sparse_dot(X, self.coef_.T,
> > +                                     dense_output=True) + self.intercept_
> > +        else:
>
> I may actually end up with a pointer to both the __weights and
> __avg_weights and then at the end, depending on the value of self.average I
> will set self.coef_ to the correct weights. This way, if a partial fit is
> run, we can continue to compute the averages
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/scikit-learn/scikit-learn/pull/3480/files#r15348873>.
>