|
2 | 2 | @author: David Diaz Vico |
3 | 3 | @license: MIT |
4 | 4 | """ |
| 5 | + |
5 | 6 | from __future__ import annotations |
6 | 7 |
|
7 | 8 | import itertools |
@@ -145,6 +146,7 @@ class ScoresInfo: |
145 | 146 | fetch_scores |
146 | 147 |
|
147 | 148 | """ |
| 149 | + |
148 | 150 | dataset_names: Sequence[str] |
149 | 151 | estimator_names: Sequence[str] |
150 | 152 | scores: np.typing.NDArray[float] |
@@ -182,9 +184,7 @@ def _iterate_outer_cv( |
182 | 184 | yield from outer_cv |
183 | 185 |
|
184 | 186 | cv = check_cv(outer_cv, y, classifier=is_classifier(estimator)) |
185 | | - yield from ( |
186 | | - (X[train], y[train], X[test], y[test]) for train, test in cv.split(X, y) |
187 | | - ) |
| 187 | + yield from ((X[train], y[train], X[test], y[test]) for train, test in cv.split(X, y)) |
188 | 188 |
|
189 | 189 |
|
190 | 190 | def _benchmark_from_data( |
@@ -690,23 +690,16 @@ def _get_experiments( |
690 | 690 | find_all_fun = getattr( |
691 | 691 | loader, |
692 | 692 | "find_all", |
693 | | - lambda: [ |
694 | | - FileSystemExperiment.from_run_dir(run_dir) |
695 | | - for run_dir in loader._runs_dir.iterdir() |
696 | | - ], |
| 693 | + lambda: [FileSystemExperiment.from_run_dir(run_dir) for run_dir in loader._runs_dir.iterdir()], |
697 | 694 | ) |
698 | 695 |
|
699 | 696 | experiments = find_all_fun() |
700 | 697 |
|
701 | | - elif (dataset_names, estimator_names) == (None, None) or isinstance( |
702 | | - loader, FileSystemExperimentLoader |
703 | | - ): |
| 698 | + elif (dataset_names, estimator_names) == (None, None) or isinstance(loader, FileSystemExperimentLoader): |
704 | 699 | load_ids_fun = getattr( |
705 | 700 | loader, |
706 | 701 | "find_by_ids", |
707 | | - lambda id_seq: [ |
708 | | - loader.find_by_id(experiment_id) for experiment_id in id_seq |
709 | | - ], |
| 702 | + lambda id_seq: [loader.find_by_id(experiment_id) for experiment_id in id_seq], |
710 | 703 | ) |
711 | 704 |
|
712 | 705 | experiments = load_ids_fun(ids) |
@@ -739,10 +732,7 @@ def _get_experiments( |
739 | 732 | e |
740 | 733 | for e in experiments |
741 | 734 | if ( |
742 | | - ( |
743 | | - estimator_names is None |
744 | | - or e.config["estimator_name"] in estimator_names |
745 | | - ) |
| 735 | + (estimator_names is None or e.config["estimator_name"] in estimator_names) |
746 | 736 | and (dataset_names is None or e.config["dataset_name"] in dataset_names) |
747 | 737 | ) |
748 | 738 | ] |
@@ -842,9 +832,7 @@ def fetch_scores( |
842 | 832 | score_std, |
843 | 833 | ) |
844 | 834 |
|
845 | | - estimator_names = ( |
846 | | - tuple(estimator_list) if estimator_names is None else estimator_names |
847 | | - ) |
| 835 | + estimator_names = tuple(estimator_list) if estimator_names is None else estimator_names |
848 | 836 | dataset_names = tuple(dataset_list) if dataset_names is None else dataset_names |
849 | 837 | matrix_shape = (len(dataset_names), len(estimator_names)) |
850 | 838 |
|
|
0 commit comments