Trusted-AI / AIF360

A comprehensive set of fairness metrics for datasets and machine learning models, explanations for these metrics, and algorithms to mitigate bias in datasets and models.
https://aif360.res.ibm.com/
Apache License 2.0
2.46k stars 840 forks source link

Tensorflow dependency on BinaryLabelDatasetMetric #250

Open martincjespersen opened 3 years ago

martincjespersen commented 3 years ago

Is it possible to change the metrics not to be dependent on tensorflow due to the auditor module as for simpler tasks it would be great not to install tensorflow.

      8 from aif360.datasets import BinaryLabelDataset
      9 
---> 10 from aif360.metrics import BinaryLabelDatasetMetric, ClassificationMetric
     11 
     12 

~/miniconda/envs/AIF/lib/python3.8/site-packages/aif360/metrics/__init__.py in <module>
      1 from aif360.metrics.metric import Metric
      2 from aif360.metrics.dataset_metric import DatasetMetric
----> 3 from aif360.metrics.binary_label_dataset_metric import BinaryLabelDatasetMetric
      4 from aif360.metrics.classification_metric import ClassificationMetric
      5 from aif360.metrics.sample_distortion_metric import SampleDistortionMetric

~/miniconda/envs/AIF/lib/python3.8/site-packages/aif360/metrics/binary_label_dataset_metric.py in <module>
      1 import numpy as np
      2 from sklearn.neighbors import NearestNeighbors
----> 3 from aif360.algorithms.inprocessing.gerryfair.auditor import Auditor
      4 from aif360.datasets import BinaryLabelDataset
      5 from aif360.datasets.multiclass_label_dataset import MulticlassLabelDataset

~/miniconda/envs/AIF/lib/python3.8/site-packages/aif360/algorithms/inprocessing/__init__.py in <module>
      4 from aif360.algorithms.inprocessing.meta_fair_classifier import MetaFairClassifier
      5 from aif360.algorithms.inprocessing.gerryfair_classifier import GerryFairClassifier
----> 6 from aif360.algorithms.inprocessing.exponentiated_gradient_reduction import ExponentiatedGradientReduction
      7 from aif360.algorithms.inprocessing.grid_search_reduction import GridSearchReduction

~/miniconda/envs/AIF/lib/python3.8/site-packages/aif360/algorithms/inprocessing/exponentiated_gradient_reduction.py in <module>
     10 
     11 from aif360.algorithms import Transformer
---> 12 from aif360.sklearn.inprocessing import ExponentiatedGradientReduction as skExpGradRed
     13 
     14 

~/miniconda/envs/AIF/lib/python3.8/site-packages/aif360/sklearn/inprocessing/__init__.py in <module>
      2 In-processing algorithms train a fair classifier (data in, predictions out).
      3 """
----> 4 from aif360.sklearn.inprocessing.adversarial_debiasing import AdversarialDebiasing
      5 from aif360.sklearn.inprocessing.exponentiated_gradient_reduction import ExponentiatedGradientReduction
      6 from aif360.sklearn.inprocessing.grid_search_reduction import GridSearchReduction

~/miniconda/envs/AIF/lib/python3.8/site-packages/aif360/sklearn/inprocessing/adversarial_debiasing.py in <module>
      5 from sklearn.utils import check_random_state
      6 from sklearn.utils.validation import check_is_fitted
----> 7 import tensorflow.compat.v1 as tf
      8 
      9 from aif360.sklearn.utils import check_inputs, check_groups

ModuleNotFoundError: No module named 'tensorflow.compat'