Description
Description
DecisionTree with mae criterion does not free used memory.
As a result that kind of trees is unusable in cycle, forests and cross-validation.
(originally i encoutered this problem while trying use grid search with mae forest)
Steps/Code to Reproduce
import sklearn
params = dict(max_depth=range(1, 10))
params = sklearn.model_selection.ParameterGrid(params)
reg = sklearn.tree.DecisionTreeRegressor(criterion='mae')
# repeated several times in jupyter cell
for p in params:
print p
for i in range(100):
reg.set_params(**p)
reg.fit(xxx, yyy)
Expected Results
No additional memory usage after first completion of cycle.
Cell with 'for' cycle is runnable unlimited times.
Replacing 'mae' with 'mse' does give expected result.
Actual Results
Additional memory is used after each cell execution.
Deleteing tree with 'del' and enforcing 'gc.collect()' does not help.
When there is no memory left OS (windows) shuts down python process.
My guess is that there is memory leak in cython.
Versions
Windows-7-6.1.7601-SP1
('Python', '2.7.12 | packaged by conda-forge | (default, Aug 12 2016, 18:53:38) [MSC v.1500 64 bit (AMD64)]')
('NumPy', '1.11.2')
('SciPy', '0.18.0')
('Scikit-Learn', '0.18')