-
Notifications
You must be signed in to change notification settings - Fork 1.3k
First draft of multi-objective optimization #1455
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
Changes from 1 commit
2885692
4e361b7
77a223e
c3b5072
fc89c68
1a09c12
19251e8
177d913
98beb3a
93cdbfc
610cda8
1557131
75c3eb4
1f90ec8
a9227b8
2c36d45
1f1d218
8de1e5a
08c3bd0
fdfed85
fe67618
0aa65e9
b1a0c72
d432e07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,18 @@ | ||
| # -*- encoding: utf-8 -*- | ||
| from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union, cast | ||
| from __future__ import annotations | ||
|
|
||
| from typing import ( | ||
KEggensperger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Any, | ||
| Callable, | ||
| Dict, | ||
| List, | ||
| Optional, | ||
| Sequence, | ||
| Tuple, | ||
| Type, | ||
| Union, | ||
| cast, | ||
| ) | ||
|
|
||
| import functools | ||
| import json | ||
|
|
@@ -86,10 +99,10 @@ def fit_predict_try_except_decorator( | |
|
|
||
|
|
||
| def get_cost_of_crash( | ||
| metric: Union[Scorer, List[Scorer], Tuple[Scorer]] | ||
| metric: Union[Scorer | Sequence[Scorer]], | ||
|
||
| ) -> Union[float, List[float]]: | ||
|
|
||
| if isinstance(metric, (List, Tuple)): | ||
| if isinstance(metric, Sequence): | ||
| return [cast(float, get_cost_of_crash(metric_)) for metric_ in metric] | ||
| elif not isinstance(metric, Scorer): | ||
KEggensperger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| raise ValueError("The metric must be stricly be an instance of Scorer") | ||
|
|
@@ -129,7 +142,7 @@ def __init__( | |
| resampling_strategy: Union[ | ||
| str, BaseCrossValidator, _RepeatedSplits, BaseShuffleSplit | ||
| ], | ||
| metric: Union[Scorer, List[Scorer], Tuple[Scorer]], | ||
| metric: Union[Scorer | Sequence[Scorer]], | ||
| cost_for_crash: float, | ||
| abort_on_first_run_crash: bool, | ||
| port: int, | ||
|
|
||
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.
Not neccessary, just something to know
Optional[X] == Union[X, None] == X | Nonei..e you could write
Scorer | Sequence[Scorer] | None = NoneThere 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.
That's look nice, will do.