Skip to content

Conversation

@ablaom
Copy link
Member

@ablaom ablaom commented Feb 10, 2023

Closes #213.

You can now do this:

features, labels = load_data("iris")
model1 = build_forest(labels, features, 2, 150) # n_trees = 150
model = build_forest(model1, labels, features, 2, 50) # add 50 trees

New docstring below.

build_forest(model, labels, features, options...; keyword_options...)

Return an updated version of model with additional n_trees=options[2] added to the
forest. Here options and keyword_options are as for the regular build_forest method,
which excludes the model argument.

Even if training data is the same in all build_forest calls, it is not practically
possible to guarantee adding trees in steps is identical to adding them all at once,
because of the way random number generators are generated and used. But in all other
respects these approaches are equivalent.

Example

features, labels = load_data("iris")
features = float.(features)
labels = string.(labels)

The call

model = build_forest(labels, features, 2, 200) # n_trees = 200

is approximately equivalent to

model1 = build_forest(labels, features, 2, 150) # n_trees = 150
model = build_forest(model1, labels, features, 2, 50) # n_trees = 50

Copy link
Member

@rikhuijzer rikhuijzer left a comment

Choose a reason for hiding this comment

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

Cool feature

@codecov-commenter
Copy link

codecov-commenter commented Feb 10, 2023

Codecov Report

❌ Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.15%. Comparing base (c5df161) to head (a05e4cd).
⚠️ Report is 28 commits behind head on dev.

Files with missing lines Patch % Lines
src/classification/main.jl 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #216      +/-   ##
==========================================
+ Coverage   87.99%   88.15%   +0.16%     
==========================================
  Files          10       10              
  Lines        1249     1266      +17     
==========================================
+ Hits         1099     1116      +17     
  Misses        150      150              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ablaom
Copy link
Member Author

ablaom commented Feb 12, 2023

@rikhuijzer Could you please take a second look?

Copy link
Member

@rikhuijzer rikhuijzer left a comment

Choose a reason for hiding this comment

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

@rikhuijzer Could you please take a second look?

Sorry for delayed response. I was away from keyboard in the weekend.

Looks good to me. Thanks for incorporating the comments

@ablaom
Copy link
Member Author

ablaom commented Feb 13, 2023

I was away from keyboard in the weekend.

Sounds healthy to me. I am often away from keyboard on weekend. It's just that my weekend finishes earlier than yours 🌐 🥝 😄

Thanks for the prompt review, @rikhuijzer

@ablaom ablaom merged commit 79f7d2f into dev Feb 13, 2023
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.

Add functionality for adding trees to an existing forest

4 participants