Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Bounded-memory local training #89

Merged
merged 7 commits into from
Apr 6, 2016
Merged

Bounded-memory local training #89

merged 7 commits into from
Apr 6, 2016

Conversation

avibryant
Copy link
Contributor

Some work from the plane, ?r @Striation @tixxit

This has the same goal as #77 but is deliberately worse code (for now) in the interests of being less invasive and getting merged quickly. It completely avoids making any useful abstractions and instead just provides the most direct implementation of a single-node, single-pass-per-expansion local trainer.

The only interesting thing it does is this: by streaming over the training data we avoid using O(training set) memory, but if we try to expand an entire level at once, we still have an O(2^depth * features) problem. So expand takes a parameter of the maximum number of tree leaves to try to expand, per tree, in any one pass, and randomly picks which ones to do (using something like reservoir sampling to get a uniform sample of leaves that don't meet the stopping criteria). This lets you trade off memory use vs. performance (by forcing more passes but capping the memory).

There's still the need to keep all of the trees in memory at once, so it's not truly constant memory, but that's harder to avoid. If it becomes a problem we can look at using bonsai representations even during training...

def containsKey(key: A): Boolean = randValue(key) <= threshold
def update(key: A, value: B) {
if(containsKey(key))
mapValues += key -> value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're just mutating these structures in place why don't we use mutable.Map for better performance?

@avibryant
Copy link
Contributor Author

Per IRL conversation, I'm going to merge this and @Striation might do a follow-up PR with his mutable optimizations.

@avibryant avibryant merged commit 9903bc7 into master Apr 6, 2016
@tixxit tixxit deleted the avi-local branch June 4, 2016 18:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants