Commit Graph

60 Commits

Author SHA1 Message Date
Gilles Louppe 44d81a0ec3 FIX: add except* in Splitter.init definitions 2015-02-23 08:19:10 +01:00
Arnaud Joly c03c01a504 ENH Bring sparse input support to tree-based methods
Author:     Arnaud Joly <arnaud.v.joly@gmail.com>
            Fares Hedayati <fares.hedayati@gmail.com>
2014-11-06 13:58:28 +01:00
Noel Dawe 7e9c093585 tree: add min_weight_fraction_leaf 2014-07-02 11:47:31 +02:00
Lars Buitinck cdd2279c09 ENH fix astype usage to prevent copying
Removed where possible; using copy=False (from utils.fixes) where needed.

Also some C integer type fixes to gradient boosting.
2014-06-18 11:01:28 +02:00
Gilles Louppe 7ce38f4405 ENH: better API for passing weighted_n_samples 2014-04-12 13:36:16 +02:00
Gilles Louppe 57a743a157 ENH: rename Node attributes to avoid confusion 2014-04-12 11:06:57 +02:00
Gilles Louppe 61dd4b4be9 FIX: weight impurity improvement by the size of the node 2014-04-12 10:33:04 +02:00
Arnaud Joly 84c3742cb3 ENH re-generate c file 2014-03-20 14:20:35 +01:00
Arnaud Joly e509724e7e ENH avoid trying to split on constant features for presort best splitter 2014-03-10 12:16:42 +01:00
Arnaud Joly 25e2c19573 FIX bug with BestSPlitter + ENH avoid searching for a split on constant features 2014-03-10 12:16:32 +01:00
Arnaud Joly 57f93fac16 ENH avoid splitting on constant features for best splitter 2014-03-10 12:16:22 +01:00
Gilles Louppe 5cc89b2d3a FIX: Recompile _gradient_boosting.c 2014-02-06 19:35:13 +01:00
Lars Buitinck 7c33502c2e ENH faster heapsort in trees
Uses the heapsort version that I'm familiar with: linear-time heapify
followed by n delete-min operations. Also cache-friendlier by copying
active features into a temporary array.

Random forest training time on covertype:
now     34.4123s
before  60.1179s
2014-01-25 15:13:01 +01:00
Joel Nothman 87194f77cb Remove 'locked', add comments 2014-01-25 22:10:18 +11:00
Joel Nothman 86fbebdadf FIX dtype refcount; block resizing after building 2014-01-24 09:30:06 +11:00
Joel Nothman e7e7133912 ENH/FIX Change Tree underlying data structure
* avoid segfault (#2726) by setting base on numpy arrays
* A struct array for tree nodes and values array (size indeterminate at
compile time) are the only underlying structure, so each node is locally
grouped memory, and joblib dumps will save only two numpy files per
tree.
* predict() uses the value array's take method, reducing code repetition
2014-01-16 09:32:16 +11:00
Gilles Louppe b3a9da908d Regenerate C files 2014-01-09 10:05:20 +01:00
Peter Prettenhofer dd680d6a2f malloc / realloc checks
correct rc values
2014-01-06 13:56:23 +01:00
Peter Prettenhofer fda6211367 pass impurity to ``impurity_improvement`` - now it is correct so that arbitrary Criteria can be used in best-first search. 2013-11-29 10:56:57 +01:00
Peter Prettenhofer cde390f2c3 remove split_impurity from node_split signature 2013-11-22 17:47:21 +01:00
Peter Prettenhofer 9d485d78c2 fix: correct impurity_improvement formula (weight by n_left and n_right) 2013-11-22 16:53:26 +01:00
Peter Prettenhofer 5847be48a5 removed Impurity struct, Criterion.child_impurity now returns impurity_left and impurity_right (not total), fix: moved pos >= end check to if branch 2013-11-22 11:28:33 +01:00
Peter Prettenhofer 4b45668212 Best-first instead of branch heuristic - identical score as GBM on covertype 2013-11-21 13:43:54 +01:00
Peter Prettenhofer 13e43d202b Implement GBM's best-first heuristic tree growing procedure . 2013-11-20 21:10:16 +01:00
Peter Prettenhofer e62d196fe7 Merge branch 'master' into gbrt-enh-stackrec-greedy
Conflicts:
	sklearn/ensemble/_gradient_boosting.c
	sklearn/tree/_tree.c
	sklearn/tree/_tree.pxd
	sklearn/tree/_tree.pyx
	sklearn/tree/tree.py
2013-11-08 14:35:33 +02:00
Peter Prettenhofer 79a67d00ba updated after tree.pxd change 2013-11-03 14:20:53 +02:00
Peter Prettenhofer e9cea77bd8 PriorityQueue for best-first tree growing
max_leaf_nodes instead of complete parameter
2013-11-03 09:40:24 +02:00
Peter Prettenhofer 1192fe64e5 Tree: compute partition specific impurity and total impurity in criterion.children_impurity. Pass partition impurity to stack to avoid re-computation (saves some runtime).
New tree parameter: complete; specifies whether complete binary trees are grows or if a greedy branch of max_depth is grown with at most max_depth + 1 leafs.
2013-11-02 01:04:23 +02:00
Olivier Grisel 30eb78de8d FIX #1622: OPTIM: remove obsolete random_state instance in the Tree class
The random_state instance is now directly handled by the Splitter class,
there is no need to store it as an attribute of the cython Tree class
anymore.

This significantly speeds up the time of unpickling the trees by not having
to reconstruct pickled numpy.random.RandomState instances.
2013-10-29 11:28:12 +01:00
Gilles Louppe 6a5a65dede ENH: use npy_int32 type 2013-10-09 13:36:02 +02:00
Gilles Louppe b9384c98cb ENH: make node_reset/split/value gil-free 2013-10-09 13:35:52 +02:00
Lars Buitinck c7266ec712 ENH back-port rand_r from 4.4BSD
This function is not available on Windows and is deprecated by POSIX.
Fetched from OpenBSD:
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/rand.c

This reverts commit 6f737ad8d5b29a098df6b2ad0fdd1db38e801db8.
2013-07-22 12:20:01 +02:00
Gilles Louppe 0c795872c8 WIP: revert use of rand_r 2013-07-22 12:20:01 +02:00
Gilles Louppe 4c032ac02f WIP: use re-entrant rand_r 2013-07-22 12:20:01 +02:00
Gilles Louppe e2363c9974 WIP: even cleaner splitter interface 2013-07-22 12:19:59 +02:00
Peter Prettenhofer bf8c786251 fix: proper dtype for SIZE_t 2013-07-22 12:19:57 +02:00
Peter Prettenhofer 4742806106 gbrt now works with new DecisionTree implementation 2013-07-22 12:19:57 +02:00
Stefano Lattarini 67ece78da4 COSMIT various typofixes
As suggested by codespell <https://github.com/lucasdemarchi/codespell>

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
2013-04-11 21:22:14 +02:00
Lars Buitinck 37c1d092f8 COSMIT shut up the build by calling np.import_array in Cython modules
$(make in 2>&1 | wc -l) down from 706 to 517.

Took the liberty of modernizing some of the Cython code while I was at it.
2013-01-10 18:00:21 +01:00
Gilles Louppe 7945e9d7df FIX: raise an exception if negative number of samples 2013-01-08 23:29:19 +01:00
Gilles Louppe 8dcec88ce8 ENH: early binding + allocate features at tree creation (by @pprett) 2013-01-08 23:29:17 +01:00
Gilles Louppe cbb8df668b FIX: roll back some changes 2013-01-08 23:28:52 +01:00
Arnaud Joly 357f3c17d7 Call DecisionTreeRegressor instead of Tree 2012-12-11 09:33:10 +01:00
Peter Prettenhofer ef9161bb47 more explicit typing (int32, float64) 2012-11-13 19:57:05 +01:00
Peter Prettenhofer 63bae39fc1 cosmit: docstrings 2012-11-11 12:37:59 +01:00
Peter Prettenhofer df909c74f3 rename dependency -> dependence 2012-10-30 08:45:34 +01:00
Peter Prettenhofer 021e9f9a68 add learn rate to partial dependency function 2012-10-22 09:26:27 +02:00
Peter Prettenhofer 7f203451a1 automatically create grid from training data
cosmit
docstrings
2012-10-14 19:57:39 +02:00
Peter Prettenhofer ab78baa280 cythonized and cosmit 2012-10-12 18:04:59 +02:00
Peter Prettenhofer 20f654032e implemented partial dependecy plot 2012-10-11 22:52:26 +02:00