Commit Graph

17 Commits

Author SHA1 Message Date
Dimitri Papadopoulos Orfanos d4d5f8c7e0
MAINT consistent use of `print(__doc__)` in examples (#21307)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
2021-10-22 15:33:22 +02:00
Thomas J. Fan 70a185ae59
MAINT Enable and run black on examples (#20502) 2021-10-07 10:13:00 +02:00
Thomas J. Fan 7cc0177f8e
MNT Replaces numpy alias with builtin typse (#17687)
* MNT Replaces numpy alias with builtin typse

* STY Lint error
2020-06-24 16:51:51 +02:00
Tilen Kusterle a8efe00876 EXA Use return_X_y=True with load_digits where appropriate (#14359) 2019-07-14 17:10:54 +02:00
Nicolas Hug c1f58745be [MRG] Add elastic net penalty to LogisticRegression (#11646)
* First draft on elasticnet penaly for LogisticRegression

* Some basic tests

* Doc update

* First draft for LogisticRegressionCV.

It seems to be working for binary classification and for multiclass when
multi_class='ovr'. I'm having a hard time figuring out the intricacies
of multi_class='multinomial'.

* Changed default to None for l1_ratio.

added warning message is user sets l1_ratio while penalty is not
elastic-net

* Some more doc

* Updated example to plot elastic net sparsity

* Fixed flake8

* Fixed test by not modifying attribute in fit

* Fixed doc issues

* WIP

* Partially fixed logistic_reg_CV for multinomial.

Also added some comments that are hopefully clear.
Still need to fix refit=False

* Fixed doc issue

* WIP

* Fixed test for refit=False in LogisticRegressionCV

* Fixed Python 2 numpy version issue

* minor doc updates

* Weird doc error...

* Added test to ensure that elastic net is at least as good as L1 or L2
once l1_ratio has been optimized with grid search

Also addressed minor reviews

* Fixed test

* addressed comments

* Added back ignore warning on tests

* Added a functional test

* Scale data in test... Now failing

* elastic-net --> elasticnet

* Updated doc for some attributes and checked their shape in tests

* Added l1_ratio dimension to coefs_paths and scores attr

* improve example + fix test

* FIX incorrect lagged_update in SAGA

* Add non-regression test for SAGA's bug

* FIX flake8 and warning

* Re fixed warning

* Updated some tests

* Addressed comments

* more comments and added dimension to LogisticRegressionCV.n_iter_ attribute

* Updated whatsnew for 0.21

* better doc shape looks

* Fixed whatnew entry after merges

* Added dot

* Addressed comments + standardized optional default param docstrings

* Addessed comments

* use swapaxes instead of unsupported moveaxis (hopefully fixes tests)
2018-11-21 20:23:57 -05:00
Olivier Grisel fc7d6e6986 [MRG] Fix FutureWarnings in logistic regression examples (#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
2018-09-24 18:22:40 +01:00
Brent Pedersen c8705478e7 use more interesting range for C in logistic l1 l2 example.
Before this change, output is (http://scikit-learn.org/dev/auto_examples/linear_model/plot_logistic_l1_l2_sparsity.html#example-linear-model-plot-logistic-l1-l2-sparsity-py):
C=10
Sparsity with L1 penalty: 6.25%
score with L1 penalty: 0.9104
Sparsity with L2 penalty: 4.69%
score with L2 penalty: 0.9093
C=100
Sparsity with L1 penalty: 6.25%
score with L1 penalty: 0.9098
Sparsity with L2 penalty: 4.69%
score with L2 penalty: 0.9098
C=1000
Sparsity with L1 penalty: 4.69%
score with L1 penalty: 0.9098
Sparsity with L2 penalty: 4.69%
score with L2 penalty: 0.9098

With this change, output is:
C=100.00
Sparsity with L1 penalty: 6.25%
score with L1 penalty: 0.9110
Sparsity with L2 penalty: 4.69%
score with L2 penalty: 0.9098
C=1.00
Sparsity with L1 penalty: 9.38%
score with L1 penalty: 0.9104
Sparsity with L2 penalty: 4.69%
score with L2 penalty: 0.9093
C=0.01
Sparsity with L1 penalty: 85.94%
score with L1 penalty: 0.8625
Sparsity with L2 penalty: 4.69%
score with L2 penalty: 0.8915
2014-07-16 15:55:48 -06:00
Rajat Khanduja 2244098532 Updated examples to use pyplot for plotting instead of pylab
Some examples not updated because scripts throw error (probably not
because of the change)
2014-05-15 02:18:07 +05:30
Robert Layton dacfd8bd5d DOC: Replaced all BSD style licenses with "BSD 3 clause"
Replaced all BSD style licenses with "BSD 3 clause"
Not checked yet!

Removed duplicate "3 clause, 3 clause"

Removed trailing period if exists

Fixed some missed licences, still about 50 to do, but those can be automated

Think I got the last of them.

Apparently me and sed have different ideas of regex.

Found a few more
2013-04-30 08:34:46 +02:00
Lars Buitinck 837093df7f P3K: use print as a function in the examples
Also corrected some typos, including two people misspelling their own names :)
2013-02-01 15:04:42 +01:00
Andreas Mueller 38b455d541 Cosmit pep8 2012-12-25 13:16:05 +01:00
Andreas Mueller c0a057843c ENH rename Scaler to StandardScaler everywhere 2012-09-23 17:31:15 +01:00
Lars Buitinck 9d33497e16 COSMIT clarify L1/L2 LR sparsity demo 2012-09-17 11:06:17 +02:00
Andreas Mueller 4968fef48f COSMIT last try to make my plot pretty.... 2012-03-04 23:05:37 +01:00
Andreas Mueller 13ea995372 ENH 2d plot for l1l2 digits example 2012-03-04 22:57:26 +01:00
Andreas Mueller 3f1570e5df COSMIT Adjust title for example gallery 2012-03-04 22:01:49 +01:00
Andreas Mueller fb21662bcf DOC another coefficient plot 2012-03-04 21:58:14 +01:00