-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from aidotse/optuna
Optuna
- Loading branch information
Showing
12 changed files
with
382 additions
and
324 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Run optuna to find best hyperparameters.""" | ||
from abc import ABC, abstractmethod | ||
from dataclasses import dataclass | ||
from typing import Optional, Self | ||
|
||
import optuna | ||
|
||
|
||
class AbstractAttack(ABC): | ||
"""Abstract attack template for attack objects.""" | ||
|
||
@abstractmethod | ||
def run_with_optuna(self:Self, optuna_config: Optional[dataclass]) -> optuna.study.Study: | ||
"""Fins optimal hyperparameters using optuna.""" | ||
pass | ||
|
||
@abstractmethod | ||
def run_attack() -> None: | ||
"""Run the attack on the target model and dataset. | ||
This method is implemented by subclasses (e.g., GIA and MIA attacks), | ||
each of which provides specific behavior and results. | ||
Returns | ||
------- | ||
Depends on the subclass implementation. | ||
""" | ||
pass | ||
|
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.