@@ -89,7 +89,7 @@ class BaseRunner(metaclass=RunnerMeta): # pylint: disable=too-many-public-metho
89
89
Scores should be in the form of `{epoch: score}`.
90
90
latest_score (float, property): Most recent score, should be in the form of `score`.
91
91
best_score (float, property): Best score, should be in the form of `score`.
92
- score_set (Optional[str]): The subset to calculate the score.
92
+ score_split (Optional[str]): The subset to calculate the score.
93
93
If is `None`, will use the last set of the result.
94
94
score_name (str): The metric name of score.
95
95
Defaults to `"loss"`.
@@ -114,9 +114,9 @@ class BaseRunner(metaclass=RunnerMeta): # pylint: disable=too-many-public-metho
114
114
}
115
115
```
116
116
117
- `scores` are dynamically extracted from `results` by `score_set ` and `score_name`.
117
+ `scores` are dynamically extracted from `results` by `score_split ` and `score_name`.
118
118
They represent the core metric that is used in comparing the performance against different models and settings.
119
- For the above `results`, If `score_set = "val"`, `score_name = "accuracy"`, then `scores = 0.9`.
119
+ For the above `results`, If `score_split = "val"`, `score_name = "accuracy"`, then `scores = 0.9`.
120
120
121
121
Attributes: IO:
122
122
dir (str, property): Directory of the run.
@@ -1076,13 +1076,13 @@ def scores(self) -> FlatDict | None:
1076
1076
r"""
1077
1077
All scores.
1078
1078
1079
- Scores are extracted from results by `score_set ` and `runner.state.score_name`,
1080
- following `[r[score_set ][self.state.score_name] for r in self.results]`.
1079
+ Scores are extracted from results by `score_split ` and `runner.state.score_name`,
1080
+ following `[r[score_split ][self.state.score_name] for r in self.results]`.
1081
1081
1082
1082
Scores are considered as the index of the performance of the model.
1083
1083
It is useful to determine the best model and the best hyper-parameters.
1084
1084
1085
- `score_set ` is defined in `self.state.score_set `.
1085
+ `score_split ` is defined in `self.state.score_split `.
1086
1086
If it is not set, `DanLing` will use `val` or `validate` if they appear in the `latest_result`.
1087
1087
If `DanLing` still could not find, it will fall back to the second key in the `latest_result`
1088
1088
if it contains more that one element, or the first key.
@@ -1093,14 +1093,14 @@ def scores(self) -> FlatDict | None:
1093
1093
if not self .results :
1094
1094
return None
1095
1095
subsets = [i for i in self .latest_result .keys () if i not in IGNORED_SET_NAMES ] # type: ignore
1096
- score_set = self .state .get ("score_set " )
1097
- if score_set is None and "val" in subsets :
1098
- score_set = "val"
1099
- if score_set is None and "validate" in subsets :
1100
- score_set = "validate"
1101
- if score_set is None :
1102
- score_set = subsets [1 ] if len (subsets ) > 1 else subsets [0 ]
1103
- return FlatDict ({k : v [score_set ][self .state .score_name ] for k , v in self .results .items ()})
1096
+ score_split = self .state .get ("score_split " )
1097
+ if score_split is None and "val" in subsets :
1098
+ score_split = "val"
1099
+ if score_split is None and "validate" in subsets :
1100
+ score_split = "validate"
1101
+ if score_split is None :
1102
+ score_split = subsets [1 ] if len (subsets ) > 1 else subsets [0 ]
1103
+ return FlatDict ({k : v [score_split ][self .state .score_name ] for k , v in self .results .items ()})
1104
1104
1105
1105
@property
1106
1106
def latest_score (self ) -> float | None :
0 commit comments