Fairness and Bias in Artificial Intelligence
By: Aswin Vijayakumar
Tags: Data Science, Fairness, Machine Learning, Artificial Intelligence, Bias

Biases in AI

Reporting Bias

Reporting bias occurs when the frequency of events, properties, and/or outcomes captured in a data set does not accurately reflect their real-world frequency. This bias can arise because people tend to focus on documenting circumstances that are unusual or especially memorable, assuming that the ordinary can “go without saying.” @Google

Explaining Reporting Bias by Statistical Entropy

Case Study 1

A mobile camera or digital camera is used as a speed gun detector to detect changes in speed of vehicles. In order to detect speed, the vehicle is detected first and then the amplitude of the image is calculated.

Reference Articles

[Optical Flow Estimation] http://www.cs.toronto.edu/~fleet/research/Papers/flowChapter05.pdf

Case Study 2

A dashcam is fitted to vehicle inside and is used to detect mistakes in lane changing. In order to detect the motion, the vehicle is detected first and then the graph of the images in the video are evaluated.

Reference Articles

[A paper on Perceived Stress Questionnaire referring to the Driver with the Dashcam] https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5981243/

1. Problem Explanation: Capture of Frequency of Events

Case Study 1: (Capture of Frequency of Events using threshold of Pixel values)

Vehicle Detection using OpenVINO

Vehicle Detection using Optical Flow Estimation and Bounding Boxes

In the above two example videos, the number of points inside each bounding box is evaluated over a set of frames. The same graph is used to show the Frame 1633 under a chosen frequency.

The challenge lies in converting this graph of information of particle count into usable statistics such as Distance and Speed or even parameters that show direct influence of statistical entropy.

— How to extract Parameters from the Exponential Graph

The example code below extracts positive values from the points inside bounding box rectangle.

def get_lookback_frame(points, lookback_frames):

# shift points by 1 frame

return points.shift(1).rolling(window=lookback_frames).min() def get_long_signal(points, lookback_frame):

# calculate the steadily increasing part of the evaluating graph

long = (points > lookback_frame).astype(np.int64)

return long def filter_signal(points, lookback_signal):

return points * lookback_signal

The example code below finds outliers in Parameters such as Speed:

# Outlier Detection

def get_return_lookback(points, lookback_frame):

# evaluate log returns of lookback and current ones

return np.log(points) - np.log(lookback_frame) def get_signal_returns(signal, lookback_returns):

# multiply the signal to lookback_returns

return signal * lookback_returns

Log Returns of Each Threshold of Points Found from Tracker

The log returns matches with the statistical entropy taken in this problem.

Calculating residual errors from a linear regression fit will provide us with outliers in speed.

To estimate the distance, the log returns is a good enough metric as it steadily decreases.

Case Study 2: (Capture of Frequency of Events using PSQs)

In evaluation of PSQs, same technique is applied. In this case the count is more or less the same across the interval which implies the table must be converted to a PCA like transformation.

Automation Bias

Automation bias is a tendency to favor results generated by automated systems over those generated by non-automated systems, irrespective of the error rates of each. @Google

2. Problem Explanation: Video Inference

Case Study 1 (Speed gun detector)

Vehicle Detection using OpenVINO

Vehicle Detection using Optical Flow Estimation and Bounding Boxes

The above video is demonstrating optical flow detection within the bounding box images as you can see. The detected points are filtered over a threshold which emits data to be sent through an analysis pipeline. The Analyzed data is used to determine the statistical parameters of the video.

So why does Automation Bias exist? Automation Bias exists when a piece of software with single original model can be used to determine the statistical properties which helps in optimization of the video characteristics.

Selection Bias

Selection Bias occurs if a data set’s examples are chosen in a way that is not reflective of their real-world distribution. Selection Bias can take many different forms: @Google

3. Problem Explanation: Evaluating a Graph

Coverage bias: Data is not selected in a representative fashion. @Google

Case Study 1: (Speed Gun Detector)

[Correct]: Collect Order of Appearance of Nodes inside Speed Gun Detector by Confidence Intervals

Collect Order of Appearance of Nodes inside Speed Gun Detector by Confidence Intervals [Wrong]: Do Particle Count from detected boxes over n frames without forming order of appearance of bounding boxes

Do Particle Count from detected boxes over n frames without forming order of appearance of bounding boxes [Correct]: Connect two adjacent frames using Order of Appearance Collected with correct threshold

Connect two adjacent frames using Order of Appearance Collected with correct threshold [Wrong]: Do Particle Count over frames by choosing the wrong threshold of pixels

The particle count inside those bounding boxes are measured from Optical Flow Phase Based Methods.

The data collected does not form a representative fashion but they are transformed into usable statistics.

viz = pd.DataFrame(columns=['vehicle', 'count', 'frame', 'nodes']) frame = 0

for n, t in zip(nodes, threshold):

frame += 1

map_n = list(map(lambda k: str(k), n))

for i, j in zip(n, t):

viz = viz.append({'vehicle': i, 'count': j, 'frame': frame, 'nodes': "-".join(map_n)}, ignore_index=True)

Non-response Bias: (or participation bias): Data ends up being unrepresentative due to participation gaps in the data-collection process. @Google

Case Study 1: (Speed Gun Detector)

Participation Gaps can occur in vehicle detection because some bounding boxes may get undetected either due to Deep Learning error which is very unlikely to happen. The other reason is when the vehicles are moving sequentially, the bounding boxes switch the Confidence Intervals or Confidence Threshold implying they change their order of appearance in the detection. This introduces participation bias in detection of a particular vehicle from a set of vehicles.

Code to Explain the Bounding Box Detection:

def draw_boxes(out_write_npy, zone, frame, result, args, width, height):

for box in result[0][0]:

# Output shape is 1x1x100x7

conf = box[2] # comparison of confidence threshold

if conf >= args.pt:

xmin = int(box[3] * width)

ymin = int(box[4] * height)

xmax = int(box[5] * width)

ymax = int(box[6] * height)

# draw bounding box rectangles

cv2.rectangle(frame, (xmin, ymin), (xmax, ymax), args.c, args.th)

return frame

Code to show participation bias of bounding boxes: