-
Notifications
You must be signed in to change notification settings - Fork 7
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
Update iopt version #150
Merged
Merged
Update iopt version #150
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
afbf3f2
Add starting point
YamLyubov be80dc9
Add categorical parameters, treat discrete and categorical as discrete
YamLyubov 2f819b2
Fix discrete setting
YamLyubov 20fa84f
Add n_jobs
YamLyubov 8e895ac
Fix for 0.2.22
YamLyubov c46357a
Fix eps
YamLyubov 6f04a65
Fix initial point
YamLyubov c736ee6
Add multi objective
YamLyubov 8b12370
Rebase
YamLyubov dbb07d4
Minor
YamLyubov 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 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 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,72 @@ | ||
from datetime import timedelta | ||
|
||
from golem.core.optimisers.graph import OptNode, OptGraph | ||
from golem.core.optimisers.objective import ObjectiveEvaluate, Objective | ||
from golem.core.tuning.iopt_tuner import IOptTuner | ||
from golem.core.tuning.search_space import SearchSpace | ||
from test.unit.utils import ParamsSumMetric | ||
|
||
|
||
def opt_graph_with_params(): | ||
node_a = OptNode('a') | ||
node_b = OptNode({'name': 'b', 'params': {'b2': 0.7, 'b3': 2}}) | ||
node_c = OptNode('c', nodes_from=[node_a]) | ||
node_d = OptNode('d', nodes_from=[node_b]) | ||
node_final = OptNode('e', nodes_from=[node_c, node_d]) | ||
graph = OptGraph(node_final) | ||
return graph | ||
|
||
|
||
def get_search_space(): | ||
params_per_operation = { | ||
'a': { | ||
'a1': { | ||
'sampling-scope': [2, 7], | ||
'type': 'discrete' | ||
}, | ||
'a2': { | ||
'sampling-scope': [1e-3, 1], | ||
'type': 'continuous' | ||
}, | ||
'a3': { | ||
'sampling-scope': [['A', 'B', 'C']], | ||
'type': 'categorical' | ||
} | ||
}, | ||
'b': { | ||
'b1': { | ||
'sampling-scope': [["first", "second", "third"]], | ||
'type': 'categorical' | ||
}, | ||
'b2': { | ||
'sampling-scope': [0.04, 1.0], | ||
'type': 'continuous' | ||
}, | ||
}, | ||
'e': { | ||
'e1': { | ||
'sampling-scope': [0.05, 1.0], | ||
'type': 'continuous' | ||
}, | ||
'e2': { | ||
'sampling-scope': [0.05, 1.0], | ||
'type': 'continuous' | ||
} | ||
}, | ||
'k': { | ||
'k': { | ||
'sampling-scope': [1e-2, 10.0], | ||
'type': 'continuous' | ||
} | ||
}} | ||
return SearchSpace(params_per_operation) | ||
|
||
|
||
if __name__ == '__main__': | ||
search_space = get_search_space() | ||
graph = opt_graph_with_params() | ||
# search for parameters that will maximize their sum | ||
obj_eval = ObjectiveEvaluate(Objective({'sum_metric': ParamsSumMetric.get_value})) | ||
|
||
tuner = IOptTuner(obj_eval, search_space, iterations=10, n_jobs=-1) | ||
tuned_graph = tuner.tune(graph) |
This file contains 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 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 |
---|---|---|
|
@@ -24,7 +24,7 @@ psutil>=5.9.2 | |
|
||
# Optimisation | ||
hyperopt>=0.2.7 | ||
iOpt==0.1.6 | ||
iOpt==0.2.22 | ||
optuna>=3.2.0 | ||
|
||
# Tests | ||
|
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а оно не должно прокидываться?