Create Example Data
Overview
Here is an example dataset for working with the Fairo metrics API.
Data Frame
# data
import json
import pandas as pd
import requests
from metrics import *
# Example DataFrame
data = [
{'name': 'Bob', 'age': 32, 'gender': 'male', 'hired': True},
{'name': 'Charlie', 'age': 28, 'gender': 'male', 'hired': True}, # 2 true positives
{'name': 'Dave', 'age': 22, 'gender': 'male', 'hired': True},
{'name': 'Dave', 'age': 22, 'gender': 'male', 'hired': True},
{'name': 'Dave', 'age': 22, 'gender': 'male', 'hired': True}, # 3 false positives
{'name': 'Dave', 'age': 22, 'gender': 'male', 'hired': False},
{'name': 'Dave', 'age': 22, 'gender': 'male', 'hired': False},
{'name': 'Dave', 'age': 22, 'gender': 'male', 'hired': False},
{'name': 'Dave', 'age': 22, 'gender': 'male', 'hired': False},
{'name': 'Dave', 'age': 22, 'gender': 'male', 'hired': False}, # 5 true negatives
{'name': 'Dave', 'age': 22, 'gender': 'male', 'hired': False}, # 1 false negative
{'name': 'Alice', 'age': 25, 'gender': 'female', 'hired': True},
{'name': 'Alice', 'age': 25, 'gender': 'female', 'hired': True}, # 2 true positive
{'name': 'Alice', 'age': 25, 'gender': 'female', 'hired': False},
{'name': 'Alice', 'age': 25, 'gender': 'female', 'hired': False},
{'name': 'Alice', 'age': 25, 'gender': 'female', 'hired': False},
{'name': 'Alice', 'age': 25, 'gender': 'female', 'hired': False}, # 4 false negative
{'name': 'Eve', 'age': 19, 'gender': 'female', 'hired': False}, # 1 true negative
{'name': 'Eve', 'age': 19, 'gender': 'female', 'hired': True},
{'name': 'Eve', 'age': 19, 'gender': 'female', 'hired': True},
{'name': 'Eve', 'age': 19, 'gender': 'female', 'hired': True}, # 3 false positive
]
data_true = [
{'gender': 'male', 'hired': True},
{'gender': 'male', 'hired': True}, # 2 true positives
{'gender': 'male', 'hired': False},
{'gender': 'male', 'hired': False},
{'gender': 'male', 'hired': False}, # 3 false positives
{'gender': 'male', 'hired': False},
{'gender': 'male', 'hired': False},
{'gender': 'male', 'hired': False},
{'gender': 'male', 'hired': False},
{'gender': 'male', 'hired': False}, # 5 true negatives
{'gender': 'male', 'hired': True}, # 1 false negative
{'gender': 'female', 'hired': True},
{'gender': 'female', 'hired': True}, # 2 true positives
{'gender': 'female', 'hired': True},
{'gender': 'female', 'hired': True},
{'gender': 'female', 'hired': True},
{'gender': 'female', 'hired': True}, # 4 false negative
{'gender': 'female', 'hired': False}, # 1 true negative
{'gender': 'female', 'hired': False},
{'gender': 'female', 'hired': False},
{'gender': 'female', 'hired': False}, # 3 false positives
]
df = pd.DataFrame(data)
y_true = pd.DataFrame(data_true)
protected_attribute = 'gender'
privileged_group = 'male'
labels = 'hired'
positive_label = True
Updated 10 months ago