-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG] Fix FutureWarnings in logistic regression examples #12114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MRG] Fix FutureWarnings in logistic regression examples #12114
Conversation
BTW, early stopping on the validation set would be nice ;) |
# Define a pipeline to search for the best combination of PCA truncation | ||
# and classifier regularization. | ||
logistic = SGDClassifier(loss='log', penalty='l2', early_stopping=True, | ||
max_iter=10000, tol=1e-5, random_state=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use SGD classifier here because it's much faster thanks to the early stopping and we are only interested in generalization (not optimization and coef values) in this specific example.
examples/compose/plot_digits_pipe.py
Outdated
plt.axis('tight') | ||
plt.xlabel('n_components') | ||
plt.ylabel('explained_variance_') | ||
fig, (ax0, ax1) = plt.subplots(nrows=2, sharex=True, figsize=(4, 5)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't read y labels in the plot.
We need a different figsize
, or to use plt.tight_layout()
.
- SCIPY_VERSION: "0.16" | ||
- MATPLOTLIB_VERSION: "1.4" | ||
- SCIKIT_IMAGE_VERSION: "0.11" | ||
- PANDAS_VERSION: "0.17.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to use DataFrame.nlargest
to make it easy to plot the results of a grid search. This causes a general bump up in the dependency versions for the documentation build. But I think this is fine.
Thanks for the feedback @TomDLT . Hopefully I fixed both the rendering issue you reported and the python 2 build. |
thanks. Generally I'm against |
…n#12114) * Be more specific about logistic regression solver in examples * Use early stopped SGD (faster) and plot cross-validated error for best models * Fix LR solver in /plot_voting_probas.pyexamples/ensemble/plot_voting_probas.py * Fix LR solver & scale data in plot_digits_classification_exercise.py * Use saga solver in plot_logistic_l1_l2_sparsity.py * Use LBFGS solver in plot_iris_logistic.py * Use LBFGS in plot_logistic.py * Use SAGA solver for Logistic Regression Path example * Use LBFGS solver in plot_classifier_chain_yeast.py * Use LBFGS solver in plot_rbm_logistic_classification.py * typo * typo * Bump up pandas dependency to 0.17.1 * Bump up examples minimal deps to match pandas 0.17.1 * Fix figure layout for plot_digits_pipe.py * Version numbers are not decimal numbers * Set multinomial, no scaling to keep example simple, fix formatting of example doc * Missing plt.tight_layout() in plot_voting_probas.py * Missing plt.tight_layout() in plot_logistic.py
I am not familiar with the new layout API. What would be the best way to ensure that the axis labels are not cropped? |
* tag '0.20.0': (77 commits) ColumnTransformer generalization to work on empty lists (scikit-learn#12084) add sparse_threshold to make_columns_transformer (scikit-learn#12152) [MRG] Convert ColumnTransformer input list to numpy array (scikit-learn#12104) Change version to 0.20.0 BUG: check equality instead of identity in check_cv (scikit-learn#12155) [MRG] Fix FutureWarnings in logistic regression examples (scikit-learn#12114) [MRG] Update test_metaestimators to pass y parameter when calling score (scikit-learn#12089) DOC Removed duplicated doc in tree.rst (scikit-learn#11922) [MRG] DOC covariance doctest examples (scikit-learn#12124) typo and formatting fixes in 0.20 doc (scikit-learn#11963) DOC Replaced the deprecated early_stopping parameter with n_iter_no_change. (scikit-learn#12133) [MRG +1] ColumnTransformer: store evaluated function column specifier during fit (scikit-learn#12107) Fix typo (scikit-learn#12126) DOC Typo in OneHotEncoder DOC Update fit_transform docstring of OneHotEncoder (scikit-learn#12117) DOC Removing quotes from variant names. (scikit-learn#12113) DOC BaggingRegressor missing default value for oob_score in docstring (scikit-learn#12108) [MRG] MNT Re-enable PyPy CI (scikit-learn#12039) MNT Only checks warnings on latest depedendencies versions in CI (scikit-learn#12048) TST Ignore warnings in common test to avoid collection errors (scikit-learn#12093) ...
* releases: (77 commits) ColumnTransformer generalization to work on empty lists (scikit-learn#12084) add sparse_threshold to make_columns_transformer (scikit-learn#12152) [MRG] Convert ColumnTransformer input list to numpy array (scikit-learn#12104) Change version to 0.20.0 BUG: check equality instead of identity in check_cv (scikit-learn#12155) [MRG] Fix FutureWarnings in logistic regression examples (scikit-learn#12114) [MRG] Update test_metaestimators to pass y parameter when calling score (scikit-learn#12089) DOC Removed duplicated doc in tree.rst (scikit-learn#11922) [MRG] DOC covariance doctest examples (scikit-learn#12124) typo and formatting fixes in 0.20 doc (scikit-learn#11963) DOC Replaced the deprecated early_stopping parameter with n_iter_no_change. (scikit-learn#12133) [MRG +1] ColumnTransformer: store evaluated function column specifier during fit (scikit-learn#12107) Fix typo (scikit-learn#12126) DOC Typo in OneHotEncoder DOC Update fit_transform docstring of OneHotEncoder (scikit-learn#12117) DOC Removing quotes from variant names. (scikit-learn#12113) DOC BaggingRegressor missing default value for oob_score in docstring (scikit-learn#12108) [MRG] MNT Re-enable PyPy CI (scikit-learn#12039) MNT Only checks warnings on latest depedendencies versions in CI (scikit-learn#12048) TST Ignore warnings in common test to avoid collection errors (scikit-learn#12093) ...
* dfsg: (77 commits) ColumnTransformer generalization to work on empty lists (scikit-learn#12084) add sparse_threshold to make_columns_transformer (scikit-learn#12152) [MRG] Convert ColumnTransformer input list to numpy array (scikit-learn#12104) Change version to 0.20.0 BUG: check equality instead of identity in check_cv (scikit-learn#12155) [MRG] Fix FutureWarnings in logistic regression examples (scikit-learn#12114) [MRG] Update test_metaestimators to pass y parameter when calling score (scikit-learn#12089) DOC Removed duplicated doc in tree.rst (scikit-learn#11922) [MRG] DOC covariance doctest examples (scikit-learn#12124) typo and formatting fixes in 0.20 doc (scikit-learn#11963) DOC Replaced the deprecated early_stopping parameter with n_iter_no_change. (scikit-learn#12133) [MRG +1] ColumnTransformer: store evaluated function column specifier during fit (scikit-learn#12107) Fix typo (scikit-learn#12126) DOC Typo in OneHotEncoder DOC Update fit_transform docstring of OneHotEncoder (scikit-learn#12117) DOC Removing quotes from variant names. (scikit-learn#12113) DOC BaggingRegressor missing default value for oob_score in docstring (scikit-learn#12108) [MRG] MNT Re-enable PyPy CI (scikit-learn#12039) MNT Only checks warnings on latest depedendencies versions in CI (scikit-learn#12048) TST Ignore warnings in common test to avoid collection errors (scikit-learn#12093) ...
Since #11905 we get warnings in when using
LogisticRegression
without setting an explicit solver or an explicitmulti_class
option.I use LBFGS and multinomial as default and SAGA when it makes sense.