SGDClassifier(warm_start=True) crashes on second call to fit() on multiclass problems.

Minimum example is at bottom. The problem is that self.coef_ in SGDClassifier is set to F-order and is not unset from it when the chain of calls from the second fit() eventually hits fit_binary(). My solution is to make sure that coef_ is set back to C-order before training. Adding minimal test case that fails without my change.

    In [1]: from sklearn.linear_model import SGDClassifier

    In [2]: X = np.random.rand(100, 10)

    In [3]: y = np.random.randint(3, size=100)

    In [4]: clf = SGDClassifier(warm_start=False)

    In [5]: clf.fit(X, y)
    Out[5]:
    SGDClassifier(alpha=0.0001, class_weight=None, epsilon=0.1, eta0=0.0,
           fit_intercept=True, l1_ratio=0.15, learning_rate='optimal',
           loss='hinge', n_iter=5, n_jobs=1, penalty='l2', power_t=0.5,
           random_state=None, rho=None, shuffle=False, verbose=0,
           warm_start=False)

    In [6]: clf.fit(X, y)
    Out[6]:
    SGDClassifier(alpha=0.0001, class_weight=None, epsilon=0.1, eta0=0.0,
           fit_intercept=True, l1_ratio=0.15, learning_rate='optimal',
           loss='hinge', n_iter=5, n_jobs=1, penalty='l2', power_t=0.5,
           random_state=None, rho=None, shuffle=False, verbose=0,
           warm_start=False)

    In [7]: clf = SGDClassifier(warm_start=True)

    In [8]: clf.fit(X, y)
    Out[8]:
    SGDClassifier(alpha=0.0001, class_weight=None, epsilon=0.1, eta0=0.0,
           fit_intercept=True, l1_ratio=0.15, learning_rate='optimal',
           loss='hinge', n_iter=5, n_jobs=1, penalty='l2', power_t=0.5,
           random_state=None, rho=None, shuffle=False, verbose=0,
           warm_start=True)

    In [9]: clf.fit(X, y)
    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
    <ipython-input-9-1a154f38b9fb> in <module>()
    ----> 1 clf.fit(X, y)

    /Users/sergeyk/.virtual_envs/system/lib/python2.7/site-packages/sklearn/linear_model/stochastic_gradient.pyc in fit(self, X, y, coef_init, intercept_init, class_weight, sample_weight)
        522                          coef_init=coef_init, intercept_init=intercept_init,
        523                          class_weight=class_weight,
    --> 524                          sample_weight=sample_weight)
        525
        526

    /Users/sergeyk/.virtual_envs/system/lib/python2.7/site-packages/sklearn/linear_model/stochastic_gradient.pyc in _fit(self, X, y, alpha, C, loss, learning_rate, coef_init, intercept_init, class_weight, sample_weight)
        421
        422         self._partial_fit(X, y, alpha, C, loss, learning_rate, self.n_iter,
    --> 423                           classes, sample_weight, coef_init, intercept_init)
        424
        425         # fitting is over, we can now transform coef_ to fortran order

    /Users/sergeyk/.virtual_envs/system/lib/python2.7/site-packages/sklearn/linear_model/stochastic_gradient.pyc in _partial_fit(self, X, y, alpha, C, loss, learning_rate, n_iter, classes, sample_weight, coef_init, intercept_init)
        374             self._fit_multiclass(X, y, alpha=alpha, C=C,
        375                                  learning_rate=learning_rate,
    --> 376                                  sample_weight=sample_weight, n_iter=n_iter)
        377         elif n_classes == 2:
        378             self._fit_binary(X, y, alpha=alpha, C=C,

    /Users/sergeyk/.virtual_envs/system/lib/python2.7/site-packages/sklearn/linear_model/stochastic_gradient.pyc in _fit_multiclass(self, X, y, alpha, C, learning_rate, sample_weight, n_iter)
        454                                 n_iter, self._expanded_class_weight[i], 1.,
        455                                 sample_weight)
    --> 456             for i in range(len(self.classes_)))
        457
        458         for i, (coef, intercept) in enumerate(result):

    /Users/sergeyk/.virtual_envs/system/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __call__(self, iterable)
        512         try:
        513             for function, args, kwargs in iterable:
    --> 514                 self.dispatch(function, args, kwargs)
        515
        516             self.retrieve()

    /Users/sergeyk/.virtual_envs/system/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in dispatch(self, func, args, kwargs)
        309         """
        310         if self._pool is None:
    --> 311             job = ImmediateApply(func, args, kwargs)
        312             index = len(self._jobs)
        313             if not _verbosity_filter(index, self.verbose):

    /Users/sergeyk/.virtual_envs/system/lib/python2.7/site-packages/sklearn/externals/joblib/parallel.pyc in __init__(self, func, args, kwargs)
        133         # Don't delay the application, to avoid keeping the input
        134         # arguments in memory
    --> 135         self.results = func(*args, **kwargs)
        136
        137     def get(self):

    /Users/sergeyk/.virtual_envs/system/lib/python2.7/site-packages/sklearn/linear_model/stochastic_gradient.pyc in fit_binary(est, i, X, y, alpha, C, learning_rate, n_iter, pos_weight, neg_weight, sample_weight)
        281                      pos_weight, neg_weight,
        282                      learning_rate_type, est.eta0,
    --> 283                      est.power_t, est.t_, intercept_decay)
        284
        285

    /Users/sergeyk/.virtual_envs/system/lib/python2.7/site-packages/sklearn/linear_model/sgd_fast.so in sklearn.linear_model.sgd_fast.plain_sgd (sklearn/linear_model/sgd_fast.c:7362)()

    ValueError: ndarray is not C-contiguous