Skip to content

Commit

Permalink
standardize parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
gumityolcu committed Jun 27, 2024
1 parent 6b1f0c6 commit d71c9e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/utils/datasets/transformed_datasets/label_grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def __init__(
device=device,
p=1.0,
subset_idx=None, # apply with certainty, to all datapoints
cls_idx=None,
)
self.n_classes = n_classes
self.classes = list(range(n_classes))
Expand Down
8 changes: 2 additions & 6 deletions src/utils/datasets/transformed_datasets/label_poisoning.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@ def __init__(
dataset: torch.utils.data.Dataset,
n_classes: int,
subset_idx: Optional[Union[List[int], torch.Tensor]] = None,
cls_idx: Optional[int] = None,
p: int = 1.0, # TODO: decide on default value vis-à-vis subset_idx
seed: int = 42,
device: str = "cpu",
):

super().__init__(
dataset=dataset,
n_classes=n_classes,
seed=seed,
device=device,
p=p,
subset_idx=subset_idx,
dataset=dataset, n_classes=n_classes, seed=seed, device=device, p=p, subset_idx=subset_idx, cls_idx=cls_idx
)
self.poisoned_labels = {}
for idx in range(self.perturbed_indices):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def __init__(
self,
dataset: torch.utils.data.Dataset,
n_classes: int,
subset_idx: Optional[Union[int, List[int], torch.Tensor]] = None,
subset_idx: Optional[Union[List[int], torch.Tensor]] = None,
cls_idx: Optional[int] = None,
p: float = 1.0,
seed: int = 42,
device: str = "cpu",
Expand All @@ -25,6 +26,8 @@ def __init__(
seed=seed,
device=device,
p=p,
subset_idx=subset_idx, # apply with certainty, to all datapoints
cls_idx=cls_idx,
subset_idx=subset_idx,
sample_fn=sample_fn,
cls_idx=cls_idx,
)

0 comments on commit d71c9e2

Please sign in to comment.