-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests to wsmf.selectors; Improve code quality
- Loading branch information
Showing
44 changed files
with
527 additions
and
383 deletions.
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
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 |
---|---|---|
@@ -1,20 +1,22 @@ | ||
from typing import Any | ||
|
||
import numpy as np | ||
from numpy.typing import NDArray | ||
from scipy.stats import rankdata | ||
|
||
|
||
def extract_best_configuration_idx_from_cluster_eval_results( | ||
datasets_inside_clusters_performances: NDArray, | ||
datasets_inside_clusters_performances: NDArray[Any], | ||
) -> int: | ||
return get_ranks_of_hp_configurations( | ||
datasets_inside_clusters_performances | ||
)[0] | ||
|
||
|
||
def get_ranks_of_hp_configurations(hp_performances: NDArray) -> list[int]: | ||
def get_ranks_of_hp_configurations(hp_performances: NDArray[Any]) -> list[int]: | ||
ranks_per_dataset = np.array( | ||
[rankdata(-row, method="dense") for row in hp_performances] | ||
) | ||
average_ranks_per_configuration = ranks_per_dataset.mean(axis=0) | ||
final_ranks = np.argsort(average_ranks_per_configuration) | ||
return final_ranks.tolist() | ||
return list(final_ranks) |
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
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,15 @@ | ||
dataset2vec==1.0.0 | ||
openml==0.14.2 | ||
loguru==0.7.2 | ||
optuna==3.6.1 | ||
xgboost==2.0.3 | ||
scikit-learn==1.4.2 | ||
pytest==8.2.1 | ||
pymfe==0.4.3 | ||
seaborn==0.13.2 | ||
tensorboard==2.17.0 | ||
numpy==1.26.4 | ||
isort==5.13.2 | ||
black==24.8.0 | ||
flake8==7.1.0 | ||
mypy==1.11.1 |
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,23 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
export PATHS_TO_CHECK="wsmf experiments_engine test" | ||
|
||
echo "Running isort" | ||
isort --profile=black --line-length=79 $PATHS_TO_CHECK | ||
|
||
echo "Running black" | ||
black --line-length=79 $PATHS_TO_CHECK | ||
|
||
echo "Running flake8" | ||
flake8 --ignore=W605,W503 --exclude experiments_engine/cd_plot.py $PATHS_TO_CHECK | ||
|
||
echo "Running mypy" | ||
mypy \ | ||
--install-types \ | ||
--non-interactive \ | ||
--ignore-missing-imports \ | ||
--strict \ | ||
--namespace-packages \ | ||
--exclude experiments_engine/cd_plot.py \ | ||
$PATHS_TO_CHECK |
File renamed without changes.
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
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
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.