Chapter 3 - sgd_clf failed to converge with scaled data
- Linguagem predominante
- Jupyter Notebook
- Estrelas
- 25.6k
- Forks
- 12.7k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
At the end of the section "Multiclass Classification," there's an example that's supposed to demonstrate improved performance on the stochastic gradient descent classifier when the data is scaled. Whenever I run cross_val_score on this example, it fails to converge. What could be causing this?
```from sklearn.preprocessing import StandardScaler
sgd_clf.random_state_ = 42
sgd_clf.max_iter_ = 8000
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train.astype(np.float64))
score(sgd_clf, X_train_scaled, y_train, cv=3, scoring="accuracy")
cross_val_score(sgd_clf, X_train_scaled, y_train, cv=3, scoring="accuracy")
/Users/mciul/anaconda3/lib/python3.8/site-packages/sklearn/linear_model/_stochastic_gradient.py:570: ConvergenceWarning: Maximum number of iteration reached before convergence. Consider increasing max_iter to improve the fit.
warnings.warn("Maximum number of iteration reached before "
```
I've been experimenting with changing the initial random state and max iterations, as above. Unless I'm misunderstanding how the classifier works, and setting these values doesn't do anything after initialization?
Any help would be appreciated. I know this isn't exactly the right place to post, but I'm not sure where else to go. Let me know if there is a forum that would be more appropriate.
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Avaliação
Esta issue ainda não foi avaliada.