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

fix: use available np.int32 instead of np.int #16

Merged
merged 4 commits into from
Feb 6, 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [macOS-latest, ubuntu-latest]
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] # TODO '3.11-dev' waiting for scikit-learn compatibility
python-version: ['3.7', '3.8', '3.9', '3.10'] # TODO '3.11-dev' waiting for scikit-learn compatibility
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion gradgpad/foundations/metrics/eer.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ def eer(scores, labels):
ths = np.clip(ths, scores.min(), scores.max())

eer = brentq(lambda x: 1.0 - x - interp1d(fars, tprs)(x), 0.0, 1.0)
eer_th = interp1d(fars, ths, kind="slinear")(eer)
eer_th = float(interp1d(fars, ths)(eer))

return eer, eer_th
2 changes: 1 addition & 1 deletion gradgpad/foundations/metrics/metrics_demographics.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _get_bpcer(self, subsets_provider: Callable):
bpcers = {}
for demographic, scores in subset_scores.items():
demographic_scores = np.asarray(list(scores.values()), dtype=np.float32)
labels = np.asarray([0] * len(demographic_scores), dtype=np.int)
labels = np.asarray([0] * len(demographic_scores), dtype=np.int32)
bpcers[demographic] = bpcer(demographic_scores, labels, eer_th) * 100.0

return bpcers
8 changes: 4 additions & 4 deletions gradgpad/foundations/scores/scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_numpy_labels(self):
annotations_from_ids, Filter(scenario=Scenario.GENUINE)
)
labels = [0 if id in filtered_ids else 1 for id in ids]
return np.asarray(labels, dtype=np.int)
return np.asarray(labels, dtype=np.int32)

def get_numpy_scores_and_labels_filtered_by_labels(self, pai_labels=None):
if not pai_labels:
Expand All @@ -86,7 +86,7 @@ def get_numpy_scores_and_labels_filtered_by_labels(self, pai_labels=None):

return (
np.asarray(list(scores), dtype=np.float32),
np.asarray(labels, dtype=np.int),
np.asarray(labels, dtype=np.int32),
)

def _get_numpy_labels_filter_by_filter(
Expand Down Expand Up @@ -128,7 +128,7 @@ def _get_numpy_labels_filter_by_filter(
if le_name_mapping.get(str(unknown_label_value)) is not None:
labels = [label - 1 for label in labels]

return np.asarray(labels, dtype=np.int)
return np.asarray(labels, dtype=np.int32)

def get_numpy_labels_by_scenario(self):
return self._get_numpy_labels_filter_by_filter(
Expand Down Expand Up @@ -175,7 +175,7 @@ def get_numpy_fine_grained_pai_labels(self):
annotation.categorization.get("fine_grained_pai")
for annotation in annotations_from_ids
]
return np.asarray(fine_grained_pai_labels, dtype=np.int)
return np.asarray(fine_grained_pai_labels, dtype=np.int32)

def _get_smallest_length(self, x):
return [
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy<2
pyte
pandas<2
seaborn<1
scikit-learn<2; python_version >= '3.7'
Expand Down