Skip to content

Commit 2a54202

Browse files
author
Alexander Ororbia
committed
cleanup of metric util
1 parent 81dcb6e commit 2a54202

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

ngclearn/utils/metric_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,13 @@ def measure_sparsity(codes, tolerance=0., preserve_batch=True, flip_measure=Fals
8989
this matrix is a non-negative vector.
9090
9191
Formally, this means we compute, per i-th row:
92+
9293
| rho(x_i) = num_zeros(x_i) / dim(x_i)
94+
9395
and for a global score for matrix X with N codes/rows, we measure:
96+
9497
| rho_mean(X) = 1/N Sum^N_{i=1} rho(x_i)
98+
9599
where lower/closer to 0 means codes more sparse and closer to 1 means
96100
codes are more dense.
97101

0 commit comments

Comments
 (0)