valor-lite 0.33.11__py3-none-any.whl → 0.33.12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- valor_lite/classification/computation.py +2 -2
- valor_lite/classification/manager.py +8 -6
- valor_lite/classification/metric.py +29 -17
- {valor_lite-0.33.11.dist-info → valor_lite-0.33.12.dist-info}/METADATA +1 -1
- {valor_lite-0.33.11.dist-info → valor_lite-0.33.12.dist-info}/RECORD +8 -8
- {valor_lite-0.33.11.dist-info → valor_lite-0.33.12.dist-info}/LICENSE +0 -0
- {valor_lite-0.33.11.dist-info → valor_lite-0.33.12.dist-info}/WHEEL +0 -0
- {valor_lite-0.33.11.dist-info → valor_lite-0.33.12.dist-info}/top_level.txt +0 -0
|
@@ -182,9 +182,9 @@ def compute_metrics(
|
|
|
182
182
|
out=precision,
|
|
183
183
|
)
|
|
184
184
|
|
|
185
|
-
accuracy = np.
|
|
185
|
+
accuracy = np.zeros(n_scores, dtype=np.float64)
|
|
186
186
|
np.divide(
|
|
187
|
-
|
|
187
|
+
counts[:, :, 0].sum(axis=1),
|
|
188
188
|
float(n_datums),
|
|
189
189
|
out=accuracy,
|
|
190
190
|
)
|
|
@@ -367,6 +367,14 @@ class Evaluator:
|
|
|
367
367
|
)
|
|
368
368
|
]
|
|
369
369
|
|
|
370
|
+
metrics[MetricType.Accuracy] = [
|
|
371
|
+
Accuracy(
|
|
372
|
+
value=accuracy.astype(float).tolist(),
|
|
373
|
+
score_thresholds=score_thresholds,
|
|
374
|
+
hardmax=hardmax,
|
|
375
|
+
)
|
|
376
|
+
]
|
|
377
|
+
|
|
370
378
|
for label_idx, label in self.index_to_label.items():
|
|
371
379
|
|
|
372
380
|
kwargs = {
|
|
@@ -401,12 +409,6 @@ class Evaluator:
|
|
|
401
409
|
**kwargs,
|
|
402
410
|
)
|
|
403
411
|
)
|
|
404
|
-
metrics[MetricType.Accuracy].append(
|
|
405
|
-
Accuracy(
|
|
406
|
-
value=accuracy[:, label_idx].astype(float).tolist(),
|
|
407
|
-
**kwargs,
|
|
408
|
-
)
|
|
409
|
-
)
|
|
410
412
|
metrics[MetricType.F1].append(
|
|
411
413
|
F1(
|
|
412
414
|
value=f1_score[:, label_idx].astype(float).tolist(),
|
|
@@ -158,24 +158,23 @@ class Recall(_ThresholdValue):
|
|
|
158
158
|
pass
|
|
159
159
|
|
|
160
160
|
|
|
161
|
-
class
|
|
161
|
+
class F1(_ThresholdValue):
|
|
162
162
|
"""
|
|
163
|
-
|
|
163
|
+
F1 score for a specific class label.
|
|
164
164
|
|
|
165
|
-
This class calculates the
|
|
166
|
-
classification task.
|
|
167
|
-
true negatives over all predictions.
|
|
165
|
+
This class calculates the F1 score at various score thresholds for a binary
|
|
166
|
+
classification task.
|
|
168
167
|
|
|
169
168
|
Attributes
|
|
170
169
|
----------
|
|
171
170
|
value : list[float]
|
|
172
|
-
|
|
171
|
+
F1 scores computed at each score threshold.
|
|
173
172
|
score_thresholds : list[float]
|
|
174
|
-
Score thresholds at which the
|
|
173
|
+
Score thresholds at which the F1 scores are computed.
|
|
175
174
|
hardmax : bool
|
|
176
175
|
Indicates whether hardmax thresholding was used.
|
|
177
176
|
label : str
|
|
178
|
-
The class label for which the
|
|
177
|
+
The class label for which the F1 score is computed.
|
|
179
178
|
|
|
180
179
|
Methods
|
|
181
180
|
-------
|
|
@@ -188,23 +187,21 @@ class Accuracy(_ThresholdValue):
|
|
|
188
187
|
pass
|
|
189
188
|
|
|
190
189
|
|
|
191
|
-
|
|
190
|
+
@dataclass
|
|
191
|
+
class Accuracy:
|
|
192
192
|
"""
|
|
193
|
-
|
|
193
|
+
Multiclass accuracy metric.
|
|
194
194
|
|
|
195
|
-
This class calculates the
|
|
196
|
-
classification task.
|
|
195
|
+
This class calculates the accuracy at various score thresholds.
|
|
197
196
|
|
|
198
197
|
Attributes
|
|
199
198
|
----------
|
|
200
199
|
value : list[float]
|
|
201
|
-
|
|
200
|
+
Accuracy values computed at each score threshold.
|
|
202
201
|
score_thresholds : list[float]
|
|
203
|
-
Score thresholds at which the
|
|
202
|
+
Score thresholds at which the accuracy values are computed.
|
|
204
203
|
hardmax : bool
|
|
205
204
|
Indicates whether hardmax thresholding was used.
|
|
206
|
-
label : str
|
|
207
|
-
The class label for which the F1 score is computed.
|
|
208
205
|
|
|
209
206
|
Methods
|
|
210
207
|
-------
|
|
@@ -214,7 +211,22 @@ class F1(_ThresholdValue):
|
|
|
214
211
|
Converts the instance to a dictionary representation.
|
|
215
212
|
"""
|
|
216
213
|
|
|
217
|
-
|
|
214
|
+
value: list[float]
|
|
215
|
+
score_thresholds: list[float]
|
|
216
|
+
hardmax: bool
|
|
217
|
+
|
|
218
|
+
def to_metric(self) -> Metric:
|
|
219
|
+
return Metric(
|
|
220
|
+
type=type(self).__name__,
|
|
221
|
+
value=self.value,
|
|
222
|
+
parameters={
|
|
223
|
+
"score_thresholds": self.score_thresholds,
|
|
224
|
+
"hardmax": self.hardmax,
|
|
225
|
+
},
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
def to_dict(self) -> dict:
|
|
229
|
+
return self.to_metric().to_dict()
|
|
218
230
|
|
|
219
231
|
|
|
220
232
|
@dataclass
|
|
@@ -3,9 +3,9 @@ valor_lite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
3
3
|
valor_lite/schemas.py,sha256=r4cC10w1xYsA785KmGE4ePeOX3wzEs846vT7QAiVg_I,293
|
|
4
4
|
valor_lite/classification/__init__.py,sha256=2wmmziIzUATm7MbmAcPNLXrEX5l4oeD7XBwPd9bWM3Q,506
|
|
5
5
|
valor_lite/classification/annotation.py,sha256=0aUOvcwBAZgiNOJuyh-pXyNTG7vP7r8CUfnU3OmpUwQ,1113
|
|
6
|
-
valor_lite/classification/computation.py,sha256=
|
|
7
|
-
valor_lite/classification/manager.py,sha256=
|
|
8
|
-
valor_lite/classification/metric.py,sha256=
|
|
6
|
+
valor_lite/classification/computation.py,sha256=pMePRFKCikYiGDgR-ZB8TmrzAts5ZIz4EywCT-XL42g,12100
|
|
7
|
+
valor_lite/classification/manager.py,sha256=fwb5z84SzgJ-ud1kTY3oYbUJLbA7R0cdWqqcaAIUcWs,23222
|
|
8
|
+
valor_lite/classification/metric.py,sha256=JjY9x6Sq1Hr_2agGnyT9EhVI5wXKQcMmEwxIK32yhGw,11903
|
|
9
9
|
valor_lite/object_detection/__init__.py,sha256=PiKfemo8FkZRzBhPSjhil8ahGURLy0Vk_iV25CB4UBU,1139
|
|
10
10
|
valor_lite/object_detection/annotation.py,sha256=o6VfiRobiB0ljqsNBLAYMXgi32RSIR7uTA-dgxq6zBI,8248
|
|
11
11
|
valor_lite/object_detection/computation.py,sha256=ZW83XT-aemRg-5ZdISmrj0bRD9wWmYCU3gkSlfXlNZc,27747
|
|
@@ -17,8 +17,8 @@ valor_lite/semantic_segmentation/computation.py,sha256=iJkEmTNmw9HwQCxSnpJkQsAdV
|
|
|
17
17
|
valor_lite/semantic_segmentation/manager.py,sha256=aJk6edWZWKqrzl6hVmEUSZVYhHLuyihxWgAIXsCXkZ0,17361
|
|
18
18
|
valor_lite/semantic_segmentation/metric.py,sha256=Y8M3z92SaABEe9TwBUN37TFsh9DR5WoIxO-TfXVwz8I,6289
|
|
19
19
|
valor_lite/text_generation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
-
valor_lite-0.33.
|
|
21
|
-
valor_lite-0.33.
|
|
22
|
-
valor_lite-0.33.
|
|
23
|
-
valor_lite-0.33.
|
|
24
|
-
valor_lite-0.33.
|
|
20
|
+
valor_lite-0.33.12.dist-info/LICENSE,sha256=M0L53VuwfEEqezhHb7NPeYcO_glw7-k4DMLZQ3eRN64,1068
|
|
21
|
+
valor_lite-0.33.12.dist-info/METADATA,sha256=Sak_wCIniTYTNYjNrF8sy-ITbFdG_j_zFUq-jz1PYLk,5632
|
|
22
|
+
valor_lite-0.33.12.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
23
|
+
valor_lite-0.33.12.dist-info/top_level.txt,sha256=9ujykxSwpl2Hu0_R95UQTR_l07k9UUTSdrpiqmq6zc4,11
|
|
24
|
+
valor_lite-0.33.12.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|