Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC Add warm start section for tree ensembles #29001

Merged
merged 6 commits into from
May 14, 2024

Conversation

lucyleeow
Copy link
Member

Reference Issues/PRs

closes #22041

What does this implement/fix? Explain your changes.

Any other comments?

Copy link

github-actions bot commented May 12, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 678e39a. Link to the linter CI: here

>>> X, y = make_classification(n_samples=100, random_state=1)
>>> clf = RandomForestClassifier(n_estimators=10)
>>> clf = clf.fit(X, y) # fit with 10 trees
>>> _ = clf.set_params(n_estimators=20, warm_start=True) # set warm_start and increase num of estimators
Copy link
Member

Choose a reason for hiding this comment

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

Line too long, might be a good idea to move the comment to the line above?

Also, do you think it makes sense to show something about the estimator before and after the second fit? To show how it changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. I just printed len(clf.estimators_).

I guess ideally we would show that the first 10 estimators are the same but I couldn't think of a good way to do that.

Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

We could export the trees with graphviz and show, but this is already a good improvement. Further improvements are very much welcome. Thanks @lucyleeow

@adrinjalali adrinjalali merged commit 3ca9fc1 into scikit-learn:main May 14, 2024
30 checks passed
@lucyleeow lucyleeow deleted the doc_warm_forest branch May 14, 2024 12:34
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request May 20, 2024
@jeremiedbb jeremiedbb mentioned this pull request May 20, 2024
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using a RandomForest's warm_start together with random_state is poorly documented
2 participants