Skip to content
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

Drop support of ray #46

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 4 additions & 33 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,42 +1,24 @@
aiosignal==1.3.1
attrs==23.1.0
black==23.3.0
certifi==2023.7.22
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
contourpy==1.1.1
coverage==7.2.2
contourpy==1.2.0
cycler==0.12.1
distlib==0.3.7
docopt==0.6.2
exceptiongroup==1.1.3
filelock==3.13.1
flake8==6.0.0
fonttools==4.44.0
frozenlist==1.4.0
grpcio==1.59.2
idna==3.4
importlib-resources==6.1.1
fonttools==4.45.0
iniconfig==2.0.0
joblib==1.3.2
jsonschema==4.19.2
jsonschema-specifications==2023.11.1
kiwisolver==1.4.5
matplotlib==3.6.3
mccabe==0.7.0
msgpack==1.0.7
mypy==1.7.0
mypy-extensions==1.0.0
numpy==1.24.1
packaging==23.2
pandas==1.5.3
pathspec==0.11.2
Pillow==10.1.0
pkgutil_resolve_name==1.3.10
platformdirs==3.11.0
platformdirs==4.0.0
pluggy==1.3.0
protobuf==4.25.0
pycodestyle==2.10.0
pyflakes==3.0.1
pyparsing==3.1.1
Expand All @@ -46,20 +28,9 @@ PyQt5-sip==12.13.0
pytest==7.2.1
python-dateutil==2.8.2
pytz==2023.3.post1
PyYAML==6.0.1
ray==2.8.0
referencing==0.31.0
requests==2.31.0
rpds-py==0.12.0
scikit-learn==1.2.2
scipy==1.10.1
six==1.16.0
threadpoolctl==3.2.0
tomli==2.0.1
tornado==6.3.3
tqdm==4.66.1
typing_extensions==4.8.0
urllib3==2.1.0
virtualenv==20.24.6
yarg==0.1.9
zipp==3.17.0
typing_extensions==4.8.0
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
"pandas>=1.4.1",
"matplotlib>=3.6.3",
"scikit-learn>=1.2.1",
"ray>=2.8.0",
"tornado>=6.2",
],
test_suite="tests",
classifiers=[
Expand Down
4 changes: 0 additions & 4 deletions size_matters/aggregation/aggregators.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import numpy as np
import pandas as pd
import ray

from size_matters.utils.inventory import COLUMNS, RELIABILITY_BOUNDS, RULES


@ray.remote
def apply_standard_approval_aggregator(annotations: pd.DataFrame) -> pd.DataFrame:
aggregated_labels = _get_aggregated_labels(annotations)

return aggregated_labels


@ray.remote
def apply_condorcet_aggregator(annotations: pd.DataFrame) -> pd.DataFrame:
vote_size = annotations.sum(axis=1)
reliabilities = (len(annotations.columns) - vote_size - 1) / (
Expand All @@ -28,7 +25,6 @@ def apply_condorcet_aggregator(annotations: pd.DataFrame) -> pd.DataFrame:
return aggregated_labels


@ray.remote
def apply_mallow_aggregator(
annotations: pd.DataFrame,
distance: str = RULES.jaccard,
Expand Down
15 changes: 6 additions & 9 deletions size_matters/evaluation/accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import logging
import matplotlib.pyplot as plt
import numpy as np
import ray
from numpy.typing import NDArray
from sklearn.metrics import zero_one_loss
from tqdm import tqdm
Expand Down Expand Up @@ -45,14 +44,12 @@ def compare_methods(dataset: Dataset, max_voters: int, n_batch: int) -> NDArray:
jaccard_labels,
dice_labels,
condorcet_labels,
) = ray.get(
[
apply_standard_approval_aggregator.remote(annotations_batch),
apply_mallow_aggregator.remote(annotations_batch, RULES.euclid),
apply_mallow_aggregator.remote(annotations_batch, RULES.jaccard),
apply_mallow_aggregator.remote(annotations_batch, RULES.dice),
apply_condorcet_aggregator.remote(annotations_batch),
]
) = (
apply_standard_approval_aggregator(annotations_batch),
apply_mallow_aggregator(annotations_batch, RULES.euclid),
apply_mallow_aggregator(annotations_batch, RULES.jaccard),
apply_mallow_aggregator(annotations_batch, RULES.dice),
apply_condorcet_aggregator(annotations_batch),
)

rules = (
Expand Down
4 changes: 0 additions & 4 deletions size_matters/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import ray

from size_matters.evaluation.accuracy import compare_methods
from size_matters.utils.inventory import DATASETS

if __name__ == "__main__": # pragma: no cover
ray.init()

dataset_name = input(f"Select a dataset [{'|'.join(DATASETS)}]: ")
assert dataset_name in DATASETS, "Invalid dataset"
dataset = DATASETS[dataset_name]
Expand Down
4 changes: 0 additions & 4 deletions tests/evaluation/test_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@ def test_compare_methods(mock_plt: MagicMock) -> None:
# Given
import random

import ray

from size_matters.evaluation.accuracy import compare_methods
from size_matters.utils.inventory import DATASETS

ray.init()

random.seed(42)
dataset = DATASETS["animals"]
max_voters = 5
Expand Down