Skip to content
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
4 changes: 3 additions & 1 deletion crowdkit/aggregation/classification/mace.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ def _initialize(self, n_workers: int, n_labels: int) -> None:
self.theta_priors_[:, 0] = self.alpha
self.theta_priors_[:, 1] = self.beta

self.strategy_priors_ = np.ones((n_workers, n_labels)) * 10.0
self.strategy_priors_ = np.multiply(
10.0, np.ones((n_workers, n_labels)), dtype=np.float64
)

def _e_step(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _aggregate_one(self, segmentations: "pd.Series[Any]") -> npt.NDArray[Any]:
for _ in range(self.n_iter):
weighted = self._segmentation_weighted(segmentations_np, weights)
mv = weighted >= 0.5
weights = self._calculate_weights(segmentations_np, mv)
weights = self._calculate_weights(segmentations_np, mv) # type: ignore[assignment,unused-ignore]

if last_aggregated is not None:
delta = weighted - last_aggregated
Expand Down
2 changes: 1 addition & 1 deletion crowdkit/aggregation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def converter(series: "pd.Series[Any]") -> "pd.Series[Any]":
series.name = name
return series

return attr.ib(init=False, converter=converter, on_setattr=attr.setters.convert) # type: ignore[no-any-return]
return attr.ib(init=False, converter=converter, on_setattr=attr.setters.convert)


def add_skills_to_data(
Expand Down
6 changes: 2 additions & 4 deletions crowdkit/metrics/data/_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"alpha_krippendorff",
]

from typing import Any, Callable, Hashable, List, Optional, Tuple, Union, cast
from typing import Any, Callable, Hashable, List, Optional, Union, cast

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -266,7 +266,5 @@ def alpha_krippendorff(
0.4444444444444444
"""
_check_answers(answers)
data: List[Tuple[Any, Hashable, Hashable]] = answers[
["worker", "task", "label"]
].values.tolist()
data = answers[["worker", "task", "label"]].values.tolist()
return float(AnnotationTask(data, distance).alpha())