Skip to content

Commit a3675c0

Browse files
committed
some more cleanup
1 parent 3a77bac commit a3675c0

8 files changed

Lines changed: 22 additions & 22 deletions

File tree

mlscorecheck/check/binary/_check_1_dataset_kfold_som.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def check_1_dataset_kfold_som(
2323
dataset: dict,
2424
folding: dict,
2525
scores: dict,
26-
eps,
26+
eps: float | dict,
2727
*,
2828
numerical_tolerance: float = NUMERICAL_TOLERANCE,
2929
prefilter_by_pairs: bool = True,

mlscorecheck/check/bundles/ehg/_tpehg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
def check_tpehg(
1313
scores: dict,
14-
eps,
14+
eps: float | dict,
1515
n_folds: int,
1616
n_repeats: int,
1717
*,

mlscorecheck/check/bundles/retina/_chasedb1.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
]
2020

2121

22-
def _filter_chasedb1(data: dict, imageset, annotator: str) -> list:
22+
def _filter_chasedb1(data: dict, imageset: str | list, annotator: str) -> list:
2323
"""
2424
Filters the CHASEDB1 dataset
2525
@@ -38,10 +38,10 @@ def _filter_chasedb1(data: dict, imageset, annotator: str) -> list:
3838

3939

4040
def check_chasedb1_vessel_aggregated_mos(
41-
imageset,
41+
imageset: str | list,
4242
annotator: str,
4343
scores: dict,
44-
eps,
44+
eps: float | dict,
4545
*,
4646
score_bounds: dict | None = None,
4747
solver_name: str | None = None,
@@ -107,7 +107,7 @@ def check_chasedb1_vessel_aggregated_mos(
107107

108108

109109
def check_chasedb1_vessel_aggregated_som(
110-
imageset, annotator: str, scores: dict, eps, numerical_tolerance=NUMERICAL_TOLERANCE
110+
imageset: str | list, annotator: str, scores: dict, eps: float | dict, numerical_tolerance: float = NUMERICAL_TOLERANCE
111111
) -> dict:
112112
"""
113113
Tests the consistency of scores calculated on the CHASEDB1 dataset using

mlscorecheck/check/bundles/retina/_stare.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def check_stare_vessel_aggregated_mos(
111111

112112

113113
def check_stare_vessel_aggregated_som(
114-
imageset, annotator: str, scores: dict, eps, numerical_tolerance=NUMERICAL_TOLERANCE
114+
imageset: str | list, annotator: str, scores: dict, eps: float | dict, numerical_tolerance: float = NUMERICAL_TOLERANCE
115115
) -> dict:
116116
"""
117117
Tests the consistency of scores calculated on the STARE dataset using
@@ -172,10 +172,10 @@ def check_stare_vessel_aggregated_som(
172172

173173

174174
def check_stare_vessel_aggregated(
175-
imageset,
175+
imageset: str | list,
176176
annotator: str,
177177
scores: dict,
178-
eps,
178+
eps: float | dict,
179179
*,
180180
score_bounds: dict | None = None,
181181
solver_name: str | None = None,
@@ -254,7 +254,7 @@ def check_stare_vessel_image(
254254
image_identifier: str,
255255
annotator: str,
256256
scores: dict,
257-
eps,
257+
eps: float | dict,
258258
*,
259259
numerical_tolerance: float = NUMERICAL_TOLERANCE,
260260
) -> dict:

mlscorecheck/check/regression/_check_regression.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def calculate_regression_scores(
113113

114114

115115
def generate_regression_problem_and_scores(
116-
random_state=None, max_n_samples=1000, subset=None, rounding_decimals=None
116+
random_state: int | None = None, max_n_samples: int = 1000, subset: list | None = None, rounding_decimals: int | None = None
117117
) -> tuple[float, int, dict]:
118118
"""
119119
Generate a regression problem and corresponding scores
@@ -150,7 +150,7 @@ def generate_regression_problem_and_scores(
150150

151151

152152
def expand_regression_scores(
153-
var: float, n_samples: int, scores: dict, eps, numerical_tolerance: float
153+
var: float, n_samples: int, scores: dict, eps: float | dict, numerical_tolerance: float
154154
) -> dict:
155155
"""
156156
Generate scores from the ones available and expand the scores to intervals given the
@@ -214,7 +214,7 @@ def check_1_testset_no_kfold(
214214
var: float,
215215
n_samples: int,
216216
scores: dict,
217-
eps,
217+
eps: float | dict,
218218
numerical_tolerance: float = NUMERICAL_TOLERANCE,
219219
) -> dict:
220220
"""

mlscorecheck/individual/_check_scores_tptn.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55

66
import copy
7-
from typing import Any
7+
from typing import Any, Callable
88

99
from ..core import NUMERICAL_TOLERANCE, logger, update_uncertainty
1010
from ._interval import Interval, IntervalUnion
@@ -45,7 +45,7 @@
4545

4646

4747
def iterate_tptn(
48-
*, score: str, score_value: float, valid_pairs: dict, sol_fun, params: dict, iterate_by: str
48+
*, score: str, score_value: float, valid_pairs: dict, sol_fun: Callable, params: dict, iterate_by: str
4949
) -> dict:
5050
"""
5151
Iterate through the potential values of tp or tn and construct feasible pairs
@@ -110,7 +110,7 @@ def update_sens(p: int, valid_pairs: dict, score_int: "Interval", solve_for: str
110110
return valid_pairs
111111

112112

113-
def update_spec(n: int, valid_pairs: dict, score_int, solve_for: str) -> dict:
113+
def update_spec(n: int, valid_pairs: dict, score_int: Interval | IntervalUnion, solve_for: str) -> dict:
114114
"""
115115
Update specificity intervals
116116
@@ -175,7 +175,7 @@ def _check_scores_tptn_pairs(
175175
p: int,
176176
n: int,
177177
scores: dict,
178-
eps,
178+
eps: float | dict,
179179
*,
180180
numerical_tolerance: float = NUMERICAL_TOLERANCE,
181181
solve_for: str | None = None,
@@ -347,7 +347,7 @@ def update_tptn(tp: Interval | IntervalUnion, tn: Interval | IntervalUnion, sols
347347

348348

349349
def _check_scores_tptn_intervals(
350-
p: int, n: int, scores: dict, eps, *, numerical_tolerance: float = NUMERICAL_TOLERANCE
350+
p: int, n: int, scores: dict, eps: float | dict, *, numerical_tolerance: float = NUMERICAL_TOLERANCE
351351
) -> dict:
352352
"""
353353
Check scores by iteratively reducing the set of feasible ``tp``, ``tn`` pairs.
@@ -484,7 +484,7 @@ def check_scores_tptn_pairs(
484484
p: int,
485485
n: int,
486486
scores: dict,
487-
eps,
487+
eps: float | dict,
488488
*,
489489
numerical_tolerance: float = NUMERICAL_TOLERANCE,
490490
solve_for: str | None = None,

mlscorecheck/individual/_complex_interval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def __repr__(self) -> str:
154154
"""
155155
return str(f"[{str(self.real)}, {str(self.imag)}]")
156156

157-
def __eq__(self, other) -> bool:
157+
def __eq__(self, other: object) -> bool:
158158
"""
159159
The equality operator
160160
@@ -169,7 +169,7 @@ def __eq__(self, other) -> bool:
169169

170170
return bool(self.real == other.real and self.imag == other.imag)
171171

172-
def __ne__(self, other) -> bool:
172+
def __ne__(self, other: object) -> bool:
173173
"""
174174
The non-equality operator
175175

mlscorecheck/individual/_expression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Expression:
2020
"""
2121

2222
def __init__(
23-
self, expression: str, symbols: list, functional_symbols: list | None = None, **kwargs
23+
self, expression: str, symbols: list, functional_symbols: list | None = None, **kwargs: dict
2424
) -> None:
2525
"""
2626
The constructor of the expression

0 commit comments

Comments
 (0)