mirror of
https://github.com/IBM/ai-privacy-toolkit.git
synced 2026-06-08 15:05:13 +02:00
Additional review comments - moved result to score base class
Signed-off-by: Maya Anderson <mayaa@il.ibm.com>
This commit is contained in:
parent
4988fea08c
commit
8a4df5a4a2
4 changed files with 11 additions and 15 deletions
|
|
@ -37,8 +37,7 @@ class DatasetAttack(abc.ABC):
|
|||
:param original_data_non_members: A container for the holdout original samples and labels,
|
||||
only samples are used in the assessment
|
||||
:param synthetic_data: A container for the synthetic samples and labels, only samples are used in the assessment
|
||||
:param config: Configuration parameters to guide the assessment process such as which attack
|
||||
frameworks to use
|
||||
:param config: Configuration parameters to guide the assessment process
|
||||
:param dataset_name: A name to identify the dataset under attack, optional
|
||||
:param attack_strategy_utils: Utils for use with the attack strategy, optional
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ from sklearn.neighbors import NearestNeighbors
|
|||
from apt.risk.data_assessment.attack_strategy_utils import KNNAttackStrategyUtils
|
||||
from apt.risk.data_assessment.dataset_attack import DatasetAttackMembership, Config
|
||||
from apt.risk.data_assessment.dataset_attack_result import DatasetAttackScore, DatasetAttackResultMembership, \
|
||||
DatasetAttackScoreWithResult, DEFAULT_DATASET_NAME
|
||||
DEFAULT_DATASET_NAME
|
||||
from apt.utils.datasets import ArrayDataset
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ class DatasetAttackConfigMembershipKnnProbabilities(Config):
|
|||
|
||||
|
||||
@dataclass
|
||||
class DatasetAttackScoreMembershipKnnProbabilities(DatasetAttackScoreWithResult):
|
||||
class DatasetAttackScoreMembershipKnnProbabilities(DatasetAttackScore):
|
||||
"""DatasetAttackMembershipKnnProbabilities privacy score.
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -50,8 +50,8 @@ class DatasetAttackScoreMembershipKnnProbabilities(DatasetAttackScoreWithResult)
|
|||
average_precision_score: the proportion of predicted members that are correctly members
|
||||
assessment_type : assessment type is 'MembershipKnnProbabilities', to be used in reports
|
||||
"""
|
||||
roc_auc_score: float
|
||||
average_precision_score: float
|
||||
roc_auc_score: float = -1.0
|
||||
average_precision_score: float = -1.0
|
||||
assessment_type: str = 'MembershipKnnProbabilities'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,20 @@
|
|||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
import numpy as np
|
||||
|
||||
DEFAULT_DATASET_NAME = "dataset"
|
||||
|
||||
|
||||
@dataclass
|
||||
class DatasetAttackScore:
|
||||
dataset_name: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class DatasetAttackResult:
|
||||
pass
|
||||
|
||||
|
||||
@dataclass(repr=False)
|
||||
class DatasetAttackScoreWithResult(DatasetAttackScore):
|
||||
result: DatasetAttackResult = field(repr=False)
|
||||
@dataclass
|
||||
class DatasetAttackScore:
|
||||
dataset_name: str
|
||||
result: Optional[DatasetAttackResult] = None
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class DatasetAttackScoreWholeDatasetKnnDistance(DatasetAttackScore):
|
|||
A value of 0.5 or close to it means good privacy.
|
||||
assessment_type : assessment type is 'WholeDatasetKnnDistance', to be used in reports
|
||||
"""
|
||||
share: float
|
||||
share: float = -1.0
|
||||
assessment_type: str = 'WholeDatasetKnnDistance'
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue