-
-
Notifications
You must be signed in to change notification settings - Fork 239
Feat/replace random forest #1246
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
Open
dengdifan
wants to merge
25
commits into
development
Choose a base branch
from
feat/replace_random_forest
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
6d10609
WIP
benjamc a8e25cb
fit api and parallel predcting
dengdifan ba48996
remnove thread lock
dengdifan fd37039
implement for predict_marginalized_over_instances_batch
dengdifan 3b39d53
add facades for pyrfr
dengdifan 33c1f05
add pyrfr mf facade
dengdifan 599ae27
maint class names
dengdifan 6edb32a
move rfr to optional requirements
dengdifan 04f837f
mainti README
dengdifan 1294009
solve conflicts
dengdifan 2ad8950
add tests for rf with log y
dengdifan 17dda1f
rf trained with n_jobs=-1 instead of None
dengdifan c660b10
make rf compatible with older version sklearn
dengdifan 340e78b
maint mypy
dengdifan 5f77534
update change log
dengdifan 398ab42
add docstrings
dengdifan ec0547a
fix black
dengdifan 66a6c1d
maint
dengdifan 8d4ec66
drop support for python 3.8
dengdifan c4a9368
maint
dengdifan ce9a74d
black fix
dengdifan a51e708
simplify pyrfr facade design
dengdifan 7c7792a
raise errors if pyrfr is not properly installed
dengdifan 8cc32c7
maint rf
dengdifan 5d9f79f
fix pre-commit
dengdifan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from smac.facade.old.hyperparameter_optimization_facade_pyrfr import ( | ||
HyperparameterOptimizationRFRFacade, | ||
) | ||
from smac.facade.old.multi_fidelity_facade_pyrfr import MultiFidelityRFRFacade | ||
|
||
__all__ = [ | ||
"HyperparameterOptimizationRFRFacade", | ||
"MultiFidelityRFRFacade", | ||
] |
50 changes: 50 additions & 0 deletions
50
smac/facade/old/hyperparameter_optimization_facade_pyrfr.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from __future__ import annotations | ||
|
||
from smac.facade.hyperparameter_optimization_facade import ( | ||
HyperparameterOptimizationFacade, | ||
) | ||
from smac.model.random_forest.pyrfr.random_forest_pyrfr import PyrfrRandomForest | ||
from smac.scenario import Scenario | ||
|
||
|
||
class HyperparameterOptimizationRFRFacade(HyperparameterOptimizationFacade): | ||
@staticmethod | ||
def get_model( # type: ignore | ||
scenario: Scenario, | ||
*, | ||
n_trees: int = 10, | ||
ratio_features: float = 1.0, | ||
min_samples_split: int = 2, | ||
min_samples_leaf: int = 1, | ||
max_depth: int = 2**20, | ||
bootstrapping: bool = True, | ||
) -> PyrfrRandomForest: | ||
"""Returns a random forest as surrogate model. | ||
|
||
Parameters | ||
---------- | ||
n_trees : int, defaults to 10 | ||
The number of trees in the random forest. | ||
ratio_features : float, defaults to 5.0 / 6.0 | ||
The ratio of features that are considered for splitting. | ||
min_samples_split : int, defaults to 3 | ||
The minimum number of data points to perform a split. | ||
min_samples_leaf : int, defaults to 3 | ||
The minimum number of data points in a leaf. | ||
max_depth : int, defaults to 20 | ||
The maximum depth of a single tree. | ||
bootstrapping : bool, defaults to True | ||
Enables bootstrapping. | ||
""" | ||
return PyrfrRandomForest( | ||
log_y=True, | ||
n_trees=n_trees, | ||
bootstrapping=bootstrapping, | ||
ratio_features=ratio_features, | ||
min_samples_split=min_samples_split, | ||
min_samples_leaf=min_samples_leaf, | ||
max_depth=max_depth, | ||
configspace=scenario.configspace, | ||
instance_features=scenario.instance_features, | ||
seed=scenario.seed, | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from __future__ import annotations | ||
|
||
from smac.facade.multi_fidelity_facade import MultiFidelityFacade | ||
from smac.facade.old.hyperparameter_optimization_facade_pyrfr import ( | ||
HyperparameterOptimizationRFRFacade, | ||
) | ||
|
||
__copyright__ = "Copyright 2022, automl.org" | ||
__license__ = "3-clause BSD" | ||
|
||
|
||
class MultiFidelityRFRFacade(MultiFidelityFacade, HyperparameterOptimizationRFRFacade): | ||
pass |
Empty file.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.