generated from aequitas-aod/template-python-project-poetry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add metrics to MulticlassLabelDataset
- Loading branch information
Showing
1 changed file
with
16 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
from aequitas.core.datasets.structured_dataset import StructuredDataset | ||
from aequitas.core.imputation_strategies.imputation_strategy import MissingValuesImputationStrategy | ||
from aequitas.core.metrics.binary_label_dataset_scores_metric import BinaryLabelDatasetScoresMetric | ||
from aif360.metrics import BinaryLabelDatasetMetric | ||
|
||
from aif360.datasets.multiclass_label_dataset import MulticlassLabelDataset | ||
|
||
|
||
class MulticlassLabelDataset(StructuredDataset, MulticlassLabelDataset): | ||
|
||
def __init__(self, imputation_strategy: MissingValuesImputationStrategy, | ||
favorable_label, unfavorable_label, **kwargs): | ||
|
||
super(MulticlassLabelDataset, self).__init__(imputation_strategy=imputation_strategy, favorable_label=favorable_label, | ||
unfavorable_label=unfavorable_label, **kwargs) | ||
def __init__(self, unprivileged_groups, privileged_groups, **kwargs): | ||
self.kwargs = kwargs | ||
self.unprivileged_groups = unprivileged_groups | ||
self.privileged_groups = privileged_groups | ||
super(MulticlassLabelDataset, self).__init__(**kwargs) | ||
|
||
@property | ||
def metrics(self, **kwargs): | ||
return BinaryLabelDatasetScoresMetric(self, **kwargs) | ||
return BinaryLabelDatasetMetric(dataset=self, | ||
unprivileged_groups=self.unprivileged_groups, | ||
privileged_groups=self.privileged_groups) | ||
|
||
@property | ||
def scores_metrics(self, **kwargs): | ||
return BinaryLabelDatasetScoresMetric(dataset=self, | ||
unprivileged_groups=self.unprivileged_groups, | ||
privileged_groups=self.privileged_groups) |