Spaces:
Build error
Build error
Debug score K
Browse files- README.md +2 -2
- vendiscore.py +1 -0
README.md
CHANGED
@@ -88,11 +88,11 @@ Given n samples, the value of the Vendi Score ranges between 1 and n, with highe
|
|
88 |
|
89 |
```
|
90 |
>>> import numpy as np
|
91 |
-
>>> vendiscore = evaluate.load("danf0/vendiscore")
|
92 |
>>> samples = [0, 0, 10, 10, 20, 20]
|
93 |
>>> k = lambda a, b: np.exp(-np.abs(a - b))
|
94 |
>>> vendiscore.compute(samples=samples, k=k)
|
95 |
-
2.9999
|
96 |
```
|
97 |
|
98 |
If you already have precomputed a similarity matrix:
|
|
|
88 |
|
89 |
```
|
90 |
>>> import numpy as np
|
91 |
+
>>> vendiscore = evaluate.load("danf0/vendiscore", "int")
|
92 |
>>> samples = [0, 0, 10, 10, 20, 20]
|
93 |
>>> k = lambda a, b: np.exp(-np.abs(a - b))
|
94 |
>>> vendiscore.compute(samples=samples, k=k)
|
95 |
+
{"VS": 2.9999...}
|
96 |
```
|
97 |
|
98 |
If you already have precomputed a similarity matrix:
|
vendiscore.py
CHANGED
@@ -145,6 +145,7 @@ class VendiScore(evaluate.Metric):
|
|
145 |
device="cpu",
|
146 |
):
|
147 |
if score_K:
|
|
|
148 |
vs = vendi.score_K(np.array(samples), normalize=normalize)
|
149 |
elif score_dual:
|
150 |
vs = vendi.score_dual(np.array(samples), normalize=normalize)
|
|
|
145 |
device="cpu",
|
146 |
):
|
147 |
if score_K:
|
148 |
+
print(samples)
|
149 |
vs = vendi.score_K(np.array(samples), normalize=normalize)
|
150 |
elif score_dual:
|
151 |
vs = vendi.score_dual(np.array(samples), normalize=normalize)
|