Compare
Provides functions to measure the similarity between devices.
dice_coefficient(device_a, device_b)
Calculates the Dice coefficient between two binary devices.
Parameters:
Name  Type  Description  Default 

device_a 
Device

The first device. 
required 
device_b 
Device

The second device. 
required 
Returns:
Type  Description 

float

The Dice coefficient between two devices. A value closer to 1 indicates more similarity. 
Source code in prefab/compare.py
hamming_distance(device_a, device_b)
Calculates the Hamming distance between two binary devices.
Parameters:
Name  Type  Description  Default 

device_a 
Device

The first device. 
required 
device_b 
Device

The second device. 
required 
Returns:
Type  Description 

int

The Hamming distance between two devices. A lower value indicates more similarity. 
Source code in prefab/compare.py
intersection_over_union(device_a, device_b)
Calculates the Intersection over Union (IoU) between two binary devices.
Parameters:
Name  Type  Description  Default 

device_a 
Device

The first device. 
required 
device_b 
Device

The second device. 
required 
Returns:
Type  Description 

float

The Intersection over Union between two devices. A value closer to 1 indicates more similarity (more overlap). 
Source code in prefab/compare.py
mean_squared_error(device_a, device_b)
Calculate the mean squared error (MSE) between two nonbinarized devices.
Parameters:
Name  Type  Description  Default 

device_a 
Device

The first device. 
required 
device_b 
Device

The second device. 
required 
Returns:
Type  Description 

float

The mean squared error between two devices. A lower value indicates more similarity. 