Skip to content

[WIP] Speed up calculation of MAE when updating tree splits #9553 - #9556

Closed
mcgibbon wants to merge 1 commit into
scikit-learn:masterfrom
mcgibbon:fast_mae
Closed

mcgibbon wants to merge 1 commit into
scikit-learn:masterfrom
mcgibbon:fast_mae

Conversation

@mcgibbon

Copy link
Copy Markdown

Reference Issue

Fixes #9553

What does this implement/fix? Explain your changes.

Modifies the MAE criterion and the WeightedMedianCalculator so that the median is updated in basically constant time each time a push or remove occurs, rather than re-computing the median from scratch every time the split is updated.

Any other comments?

This is a work in progress. Right now everything should be implemented and isn't crashing, but the code is scaling the same as it was before the change, for unknown reasons.

This is now used by the MAE criterion. It is supposed to make
re-computing the median faster when the split is updated.
@amueller

amueller commented Aug 15, 2017 •

Copy link
Copy Markdown
Member

Tests fail, so it's likely there's something fishy.
Have you run a C profiler on this like gprof?
(Actually, I'm not sure what the best toolchain for profiling is right now, @raghavrv or @jmschrei might know).

@mcgibbon

Copy link
Copy Markdown
Author

Yes, the implementation is definitely wrong (I have some ideas on what to check, lots of opportunities for sign or off-by-one errors), but I'm for the moment more concerned with how the scaling didn't improve, despite what seems to be clearly removing an inner loop. There might be another inner loop somewhere (for example, when sorting the array used by WeightedMedianCalculator each time an item gets pushed, but that might not be the case because items are moved from right-to-left and put on the end before bubbling, so they shouldn't have to bubble far if at all).

I'm trying to get some kind of profiling solution working but haven't been successful. All I've gotten is that pretty much all the time is spent in _tree.pyx:146(build).

@mcgibbon mcgibbon closed this Aug 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use median instead of mean when constructing RandomForestRegressor

2 participants