Model architectures 🏛

Metrics 📊

Solvers / Optimizers 🧮

Scheduler ⏰

Training parameters

Augmentations

DEPLOYMENT

Powered By GitBook

Hamming Score

Metric for Accuracy of Multi Label Multi Class Prediction

Hamming Score is the fraction of correct predictions compared to the total labels. This is similar to Accuracy, and in fact they are interchangeable.

Code implementation

hamming_score.py

1

truth = [0, 1, 1, 0, 0] # Multi hot labels for one input (class 1 and 2 are present)

2

prediction = [1, 1, 1, 0, 0] # Predicted labels for the input

3

num_classes = len(truth)

4

num_samples = 1

5

6

numerator = float(sum(truth & prediction))

7

denominator = float(sum(truth | prediction))

8

9

hamming_score = numerator / denominator

Copied!

Further resources

Last modified 4mo ago

Copy link