tapas.report.attack_summary.LabelInferenceAttackSummary
- class tapas.report.attack_summary.LabelInferenceAttackSummary(labels, predictions, scores=None)
Bases:
tapas.report.attack_summary.AttackSummaryClass summarising main performance metrics of a label-inference attack.
- __init__(labels, predictions, scores=None)
- Parameters
labels (list[int]) – List with true labels of the target membership in the dataset.
predictions (list[int]) – List with the predicted labels of the target membership in the dataset.
scores (list[float]) – List with the scores related to each prediction.
Methods
__init__(labels, predictions[, scores])- param labels
List with true labels of the target membership in the dataset.
get_metric_filename([postfix])Returns the name of the file to save to.
Calculates all MIA relevant metrics and returns it as a dataframe.
write_metrics(output_path[, postfix])Write metrics to file.
Attributes
Accuracy of the attacks based on the rate of correct predictions.
- property accuracy
Accuracy of the attacks based on the rate of correct predictions.
- Return type
float
- get_metric_filename(postfix='')
Returns the name of the file to save to.
- Parameters
postfix (str) – An optional string to append to the filename.
- get_metrics()
Calculates all MIA relevant metrics and returns it as a dataframe.
- Returns
A dataframe with attack info and metrics. The dataframe has the following structure. Index:
RangeIndex
- Columns:
accuracy: float
- Return type
A dataframe
- write_metrics(output_path, postfix='')
Write metrics to file.
- Parameters
output_path (str) – The prefix of the path where the metrics should be saved.
postfix (str) – An optional string to append to the filename