Commit Graph

977 Commits

Author SHA1 Message Date
Rüdiger Busche d300f406ae MAINT Simplify super() calls (#12812) 2019-01-10 22:27:06 +01:00
Roman Yurchak acb8106472 MNT Use list and dict comprehension (#12668) 2019-01-08 09:32:34 +11:00
Andreas Mueller 952ef6637a MRG Drop legacy python / remove six dependencies (#12639) 2019-01-03 15:50:05 +02:00
Bartosz Michałowski fa98a72dcc MNT Replaced all occurrences of assert_true and assert_false with assert (#12588) 2018-11-28 09:16:26 +08:00
Nicolas Hug 4ab60559c8 MNT Change deprecation for min_impurity_split from removal to changing the default (#12400) 2018-11-20 09:54:08 +11:00
Adrin Jalali 02dc9ed680 Fix max_depth overshoot in BFS expansion of trees (#12344)
* fix the issue with max_depth and BestFirstTreeBuilder

* fix the test

* fix max_depth overshoot in BFS expansion

* fix forest tests

* remove the warning, add whats_new entry

* remove extra line

* add affected classes to changed classes

* add other affected estimators to the whats_new changed models

* shorten whats_new changed models entry
2018-11-13 13:10:33 -05:00
Roopam Sharma c6455fa77f Fix include .pxd definitions for sklearn.tree in wheels (#12381) 2018-10-31 09:39:23 +01:00
Andreas Mueller c13ba26c47
[MRG] Matplotlib tree plotting (#9251)
* add reingold tillford tree layout algorithm

* add first silly implementation of matplotlib based plotting for trees

* object oriented design for export_graphviz so it can be extended

* add class for mlp export

* add colors

* separately scale x and y, add arrowheads, fix strings

* implement max_depth

* don't use alpha for coloring because it makes boxes transparent

* remove unused variables

* vertical center of boxes

* fix/simplify newline trimming

* somewhere in the middle of stuff

trying to get rid of scalex, scaley

* remove "find_longest_child" for now, fix tests

* make scalex and scaley internal, and ax local.

render everything once to get the bbox sizes, then again to actually plot it with known extents.

* add some margin to the max bbox width

* add _BaseTreeExporter baseclass

* add docstring to plot_tree

* use data coordinates so we can put the plot in a subplot, remove some hacks.

* remove scalex, scaley, add automatic font size

* use rendered stuff for setting limits (well nearly there)

* import plot_tree into tree module

* set limits before font size adjustment?

* add tree plotting via matplotlib to iris example and to docs

* pep8 fix

* skip doctest on plot_tree because matplotlib is not installed on all CI machines

* redo everything in axis pixel coordinates

re-introduce scalex, scaley
add max_extents to tree to get tree size before plotting

* fix max-depth

parent node positioning and don't consider deep nodes in layouting

* consider height in fontsize computation

in case someone gave us a very flat figure

* fix error when max_depth is None

* add docstring for tree plotting fontsize

* starting on jnothman's review

* renaming fixes

* whatsnew for tree plotting

* clear axes prior to doing anything.

* fix doctests

* skip matplotlib doctest

* trying to debug circle failure

* trying to show full traceback

* more print debugging

* remove debugging crud

* hack around matplotlib <1.5 issues

* copy bbox args because old matplotlib is weird.

* pep8 fixes

* add explicit boxstyle

* more pep8

* even more pep8

* add comment about matplotlib version requirement

* remove redundant file

* add whatsnew entry that the merge lost

* fix merge issue

* more merge issues

* whitespace ...

* remove doctest skip to see what's happening

* added some simple invariance tests buchheim function

* refactor
___init__ into superclass

* added some tests of plot_tree

* put skip back in, fix typo, fix versionadded number

* remove unused parameters special_characters and parallel_leaves from mpl plotting

* rename tests to test_reingold_tilford

* added license header from pymag-trees repo

* remove duplicate test file.
2018-10-11 15:42:02 -04:00
Adrin Jalali a80bbd9403 ENH add get_n_leaves() and get_max_depth() to DesicionTrees (#12300) 2018-10-10 22:01:11 +11:00
TakingItCasual 1e052e9da9 Converting http to https (2)... (#12292) 2018-10-04 23:06:14 +02:00
Joel Nothman 79f5d147ea MNT Revert the deprecation of min_samples_leaf and min_weight_fraction_leaf (#11998) 2018-09-08 16:43:21 +02:00
Joel Nothman 2fe58e517c Deprecate min_samples_leaf and min_weight_fraction_leaf (#11870) 2018-08-23 08:30:47 +03:00
jakirkham 4c8dec33c4 [MRG] MNT: Avoid extra copies when using asfortranarray (#11693) 2018-07-29 13:41:59 +10:00
ZJ Poh adddf00433 [MRG] np.ones -> np.full (#11628) 2018-07-23 09:49:01 +02:00
Zhiqing Xiao 8a15053073 Correct in typo in comments. (#11595)
Correct in typo in comments.
new_po -> new_pos
2018-07-17 10:32:22 -05:00
JohnStott 6ade12a55b [MRG+2] Tree MAE fix to ensure sample_weights are used during impurity calculation (#11464)
* Fix to allow M

* Updated MAE test to consider sample_weights in calculation

* Removed comment

* Fixed: E501 line too long (82 > 79 characters)

* syntax correction

* Added fix details

* Changed to use consistent datatypes during calculaions

* Corrected formatting

* Requested Changes

* removed explicit casts

* Removed unnecessary explicits

* Removed unnecessary explicit casts

* added additional test

* updated comments

* Requested changes incl additional unit test

* fix mistake

* formatting

* removed whitespace

* added test notes

* formatting

* Requested changes

* Trailing space fix attempt

* Trailing whitespace fix attempt #2

* Remove trailing whitespace
2018-07-17 14:49:20 +02:00
lkjcalc 5045c9bc6b DOC Fix ExtraTree docstrings (#11454) 2018-07-08 09:06:51 +08:00
Andreas Mueller eec7649236 MAINT Complete 0.20 deprecations (#9570) 2018-06-24 23:06:26 +10:00
Hanmin Qin 1480e9ffd8 DOC Improve doc of Tree object in DecisionTreeClassifier/Regressor (#11228) 2018-06-11 09:00:55 +10:00
Hanmin Qin 4a90d6824b DOC Broken link in ExtraTreeClassifier/Regressor 2018-06-10 21:58:46 +08:00
Roman Yurchak e8d8b8eeb0 TST: parametrize unit tests (#11074)
yield tests are deprecated in pytest and will be removed in pytest 4.0.
They all have been replaced by parametrize.
2018-06-08 14:59:33 +02:00
Nicholas Nadeau, P.Eng., AVS 3e26fc63be MAINT Fixing Typos (#11017) 2018-04-24 09:32:25 +10:00
Luis Pedro Coelho cc600b4417 DOC use "fraction" and not "percentage" (#10653)
Percentage would imply that the value would be divided by 100.
2018-02-18 10:46:05 +11:00
Jonathan Ohayon 2b835a0ce8 [MRG+1] change threshold computation in trees (#10536) 2018-02-08 11:09:52 -08:00
ksemb 77418a0275 MAINT Fix escape sequences that are deprecated in Python 3.6 (#10578)
https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
2018-02-07 10:41:21 +11:00
Joel Nothman 229183bc3a TST fix: X_sparse_mix was not dense (#10484) 2018-01-17 16:12:28 +01:00
shenhanc78 12c5ce25e8 FIX properly handle corner case. (#10450)
There is one test case that fails undefined behavior test. This happens
when n is 0, which resutls in log(n) evalutes to -inf. And to convert
-inf to integer is undefined behavior and causes exception when
undefined behavior check is turned on.

Properly handle this by early return when sorting array is zero length.

I agree this might be an usage error instead of a bug, but to leave it
vulnerable to undefined behavior exception might not a good idea.

Undefined behavior check is happy after this fix.
2018-01-17 22:59:11 +11:00
Joel Nothman c3bdc0a89a
DOC clean up assorted type specifications (#10441) 2018-01-11 09:11:17 +11:00
Camil Staps d5232435b6 [MRG + 2] Export ClassificationCriterion and RegressionCriterion (#10325) 2017-12-18 16:10:54 +01:00
Mabel c62338feb5 FIX export_graphviz should work with a sklearn.tree._tree.Tree (#10234) 2017-12-04 13:28:19 +11:00
fenx 4bba21659c [MRG+1] Error raised when presort in gradient_boosting.py and tree.py is not a boolean (#10110) 2017-11-28 13:27:13 +01:00
FarahSaeed 439bf1ac89 TEST caught deprecation warning for min_impurity_split (#10202) 2017-11-27 21:40:47 +11:00
Loïc Estève e7e05d844f [MRG+1] Remove nose from CIs and documentation (#9840) 2017-11-16 20:20:35 +01:00
Loïc Estève 846313b570 [MRG+1] Deprecate sklearn.utils.testing.raises and remove it from tests (#9660) 2017-09-01 12:53:59 +02:00
Luciano Viola 964a7f78b4 added tree of type "regressor" to the docstring of exportviz (#9530) 2017-08-11 16:06:30 -04:00
Minghui Liu ffe9866e5f Use base.is_classifier instead instead of isinstance (#9482) 2017-08-08 14:36:03 +02:00
Warut Vijitbenjaronk 8485d3eb5c [MRG] Add Explanation of MSE vs Friedman MSE vs MAE criterion in Regression Tree Building (#9367)
* clarified documentation for regression tree criterion

* added explanation on doc/modules/tree.rst
2017-07-17 10:02:18 -07:00
Olivier Grisel 07590331c4 FIX make test_importances pass on 32 bit linux 2017-07-13 20:08:45 +02:00
Thomas Moreau cb1b6c4734 FIX t-SNE memory usage and many other optimizer issues (#9032)
Use a sparse matrix representation of the neighbors.
Re-factored the QuadTree implementation to avoid insertion errors.
Various fixes in the gradient descent schedule to get the Barnes Hut and exact solvers to behave more robustly and consistently.
2017-07-12 22:56:02 +02:00
(Venkat) Raghav, Rajagopalan b6f8865b0a [MRG + 1 (rv) + 1 (alex) + 1] Add a check to test the docstring params and their order (#9206)
* add automatic test of docstrings for function / method signatures using numpydoc
2017-07-11 18:42:10 +02:00
Jean Helie ac41281451 [MRG+1] Fix alerts found with lgtm (#9278)
* compare values rather than references

* add __ne__ to class

* add missing self parameter

* properly initialise child class using super()

* remove useless loop variables and assigments

* remove useless return statements

* respect PEP8 style

* fix another flake8 check
2017-07-05 17:22:21 +10:00
Sebastin Santy dc43486806 Remove unused imports (#9235) 2017-07-01 05:57:54 -07:00
Taehoon Lee ebf2bf8107 Fix typos (#9205) 2017-06-23 11:43:46 +02:00
Vivek Kumar a150d93078 Updated error message for max_leaf_nodes (#8975)
Solves #8964
2017-06-02 09:29:59 -07:00
Guillaume Lemaitre 92cb166647 [MRG] DOC Homogeneous deprecation in docstring (#8907)
Update developers doc to use "deprecated" sphinx directive.
2017-05-23 08:42:08 +02:00
Lera 8717a159ab [MRG] Extended explanation of using class_weight in RandomForestClassifier (Issue #6646) (#8838)
* Extended explanation of using class_weight in RandomForestClassifier

* Extended explanation of using class_weight in DecisionTreeClassifier,ExtraTreesClassifier and compute_sample_weight()

* Rephrased description.

* Rephrased description (remove "indicator")
2017-05-09 18:21:12 +10:00
Guillaume Lemaitre 00da9cc534 [MRG+1] EHN add decimals parameter for export_graphviz (#8698)
* EHN add decimals parameter for export_graphviz

* FIX address comments

* TST add test for classification

* TST/FIX address comments

* FIX comments raghav
2017-04-29 15:14:57 +02:00
Li Li 2f1c9786cc [MRG+1] check length of feature_names in export_graphviz (#8477) (#8512)
* #8477

check length of feature_names in export_graphviz

- raise ValueError if len(feature_names) > tree.n_features
- add unit test for len(feature_names) > tree.n_features
- change the comment of existing unit test for len(feature_names) <
tree.n_features

* fix error and warning

- include length of feature_names and number of features in tree in the
error and warning message.
- raise error for too few feature_names
- for too much feature_names, will use the first n_features. raise an
warning for users
- use assert_raise_message and assert_warns_message in test to check
message.

* move the error and warning from node_to_str to export_graphviz so it will fail early for wrong length of feature_names

* raise error if length of feature_names does not match number of features in the decision tree

* fix pep8

* remove unused assert_warns_message import in test_export.py

* add bug fix in doc/whats_new.rst

* fix the english in doc/whats_new.rst

* fix the format and english in sklearn/tree/export.py

* fix contributor format in doc/whats_new.rst

* fix english, use bracket and avoid \ in error message

* fix pep8

* fix pep8
2017-04-26 21:58:20 +02:00
Hanmin Qin 834608ec1d MAINT Remove unused condition (#8778) 2017-04-23 22:14:42 +10:00
Hanmin Qin 2beefbc4b3 [MRG] Improve the error message of export_graphviz if a not-fitted decision tree is provided (#8776) 2017-04-23 11:34:08 +10:00