valor-lite 0.33.19__py3-none-any.whl → 0.34.0__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.

Potentially problematic release.


This version of valor-lite might be problematic. Click here for more details.

@@ -212,7 +212,7 @@ def _count_with_examples(
212
212
  data: NDArray[np.float64],
213
213
  unique_idx: int | list[int],
214
214
  label_idx: int | list[int],
215
- ) -> tuple[NDArray[np.float64], NDArray[np.int32], NDArray[np.int32]]:
215
+ ) -> tuple[NDArray[np.float64], NDArray[np.int32], NDArray[np.intp]]:
216
216
  """
217
217
  Helper function for counting occurences of unique detailed pairs.
218
218
 
@@ -231,7 +231,7 @@ def _count_with_examples(
231
231
  Examples drawn from the data input.
232
232
  NDArray[np.int32]
233
233
  Unique label indices.
234
- NDArray[np.int32]
234
+ NDArray[np.intp]
235
235
  Counts for each unique label index.
236
236
  """
237
237
  unique_rows, indices = np.unique(
@@ -288,12 +288,14 @@ def compute_confusion_matrix(
288
288
  n_labels = label_metadata.shape[0]
289
289
  n_scores = score_thresholds.shape[0]
290
290
 
291
- confusion_matrix = -1 * np.ones(
291
+ confusion_matrix = np.full(
292
292
  (n_scores, n_labels, n_labels, 2 * n_examples + 1),
293
+ fill_value=-1.0,
293
294
  dtype=np.float32,
294
295
  )
295
- unmatched_ground_truths = -1 * np.ones(
296
+ unmatched_ground_truths = np.full(
296
297
  (n_scores, n_labels, n_examples + 1),
298
+ fill_value=-1,
297
299
  dtype=np.int32,
298
300
  )
299
301
 
@@ -387,4 +389,4 @@ def compute_confusion_matrix(
387
389
  1 : misprd_label_examples.shape[0] + 1,
388
390
  ] = misprd_label_examples[:, 0].flatten()
389
391
 
390
- return confusion_matrix, unmatched_ground_truths
392
+ return confusion_matrix, unmatched_ground_truths # type: ignore[reportReturnType]
@@ -4,6 +4,7 @@ from dataclasses import dataclass
4
4
  import numpy as np
5
5
  from numpy.typing import NDArray
6
6
  from tqdm import tqdm
7
+
7
8
  from valor_lite.classification.annotation import Classification
8
9
  from valor_lite.classification.computation import (
9
10
  compute_confusion_matrix,
@@ -38,7 +39,7 @@ filtered_metrics = evaluator.evaluate(filter_mask=filter_mask)
38
39
 
39
40
  @dataclass
40
41
  class Filter:
41
- indices: NDArray[np.int32]
42
+ indices: NDArray[np.intp]
42
43
  label_metadata: NDArray[np.int32]
43
44
  n_datums: int
44
45
 
@@ -169,8 +170,7 @@ class Evaluator:
169
170
  label_metadata_per_datum = self._label_metadata_per_datum.copy()
170
171
  label_metadata_per_datum[:, ~mask] = 0
171
172
 
172
- label_metadata = np.zeros_like(self._label_metadata, dtype=np.int32)
173
- label_metadata = np.transpose(
173
+ label_metadata: NDArray[np.int32] = np.transpose(
174
174
  np.sum(
175
175
  label_metadata_per_datum,
176
176
  axis=1,
@@ -2,6 +2,7 @@ from collections import defaultdict
2
2
 
3
3
  import numpy as np
4
4
  from numpy.typing import NDArray
5
+
5
6
  from valor_lite.classification.metric import Metric, MetricType
6
7
 
7
8
 
@@ -381,9 +381,9 @@ def compute_precion_recall(
381
381
  _, indices_gt_unique = np.unique(
382
382
  tp_candidates[:, [0, 1, 4]], axis=0, return_index=True
383
383
  )
384
- mask_gt_unique = np.zeros(tp_candidates.shape[0], dtype=bool)
384
+ mask_gt_unique = np.zeros(tp_candidates.shape[0], dtype=np.bool_)
385
385
  mask_gt_unique[indices_gt_unique] = True
386
- true_positives_mask = np.zeros(n_rows, dtype=bool)
386
+ true_positives_mask = np.zeros(n_rows, dtype=np.bool_)
387
387
  true_positives_mask[mask_tp_inner] = mask_gt_unique
388
388
 
389
389
  # calculate intermediates
@@ -452,9 +452,9 @@ def compute_precion_recall(
452
452
  _, indices_gt_unique = np.unique(
453
453
  tp_candidates[:, [0, 1, 4]], axis=0, return_index=True
454
454
  )
455
- mask_gt_unique = np.zeros(tp_candidates.shape[0], dtype=bool)
455
+ mask_gt_unique = np.zeros(tp_candidates.shape[0], dtype=np.bool_)
456
456
  mask_gt_unique[indices_gt_unique] = True
457
- true_positives_mask = np.zeros(n_rows, dtype=bool)
457
+ true_positives_mask = np.zeros(n_rows, dtype=np.bool_)
458
458
  true_positives_mask[mask_tp_outer] = mask_gt_unique
459
459
 
460
460
  # count running tp and total for AP
@@ -501,8 +501,8 @@ def compute_precion_recall(
501
501
  )
502
502
 
503
503
  # calculate average precision
504
- running_max_precision = np.zeros((n_ious, n_labels))
505
- running_max_score = np.zeros((n_labels))
504
+ running_max_precision = np.zeros((n_ious, n_labels), dtype=np.float64)
505
+ running_max_score = np.zeros((n_labels), dtype=np.float64)
506
506
  for recall in range(100, -1, -1):
507
507
 
508
508
  # running max precision
@@ -528,8 +528,12 @@ def compute_precion_recall(
528
528
 
529
529
  # calculate mAP and mAR
530
530
  if unique_pd_labels.size > 0:
531
- mAP = average_precision[:, unique_pd_labels].mean(axis=1)
532
- mAR = average_recall[:, unique_pd_labels].mean(axis=1)
531
+ mAP: NDArray[np.float64] = average_precision[:, unique_pd_labels].mean(
532
+ axis=1
533
+ )
534
+ mAR: NDArray[np.float64] = average_recall[:, unique_pd_labels].mean(
535
+ axis=1
536
+ )
533
537
  else:
534
538
  mAP = np.zeros(n_ious, dtype=np.float64)
535
539
  mAR = np.zeros(n_scores, dtype=np.float64)
@@ -561,14 +565,14 @@ def compute_precion_recall(
561
565
  accuracy,
562
566
  counts,
563
567
  pr_curve,
564
- )
568
+ ) # type: ignore[reportReturnType]
565
569
 
566
570
 
567
571
  def _count_with_examples(
568
572
  data: NDArray[np.float64],
569
573
  unique_idx: int | list[int],
570
574
  label_idx: int | list[int],
571
- ) -> tuple[NDArray[np.float64], NDArray[np.int32], NDArray[np.int32]]:
575
+ ) -> tuple[NDArray[np.float64], NDArray[np.int32], NDArray[np.intp]]:
572
576
  """
573
577
  Helper function for counting occurences of unique detailed pairs.
574
578
 
@@ -587,7 +591,7 @@ def _count_with_examples(
587
591
  Examples drawn from the data input.
588
592
  NDArray[np.int32]
589
593
  Unique label indices.
590
- NDArray[np.int32]
594
+ NDArray[np.intp]
591
595
  Counts for each unique label index.
592
596
  """
593
597
  unique_rows, indices = np.unique(
@@ -907,4 +911,4 @@ def compute_confusion_matrix(
907
911
  confusion_matrix,
908
912
  unmatched_predictions,
909
913
  unmatched_ground_truths,
910
- )
914
+ ) # type: ignore[reportReturnType]
@@ -4,6 +4,7 @@ from dataclasses import dataclass
4
4
  import numpy as np
5
5
  from numpy.typing import NDArray
6
6
  from tqdm import tqdm
7
+
7
8
  from valor_lite.object_detection.annotation import Detection
8
9
  from valor_lite.object_detection.computation import (
9
10
  compute_bbox_iou,
@@ -42,8 +43,8 @@ filtered_metrics = evaluator.evaluate(iou_thresholds=[0.5], filter_mask=filter_m
42
43
 
43
44
  @dataclass
44
45
  class Filter:
45
- ranked_indices: NDArray[np.int32]
46
- detailed_indices: NDArray[np.int32]
46
+ ranked_indices: NDArray[np.intp]
47
+ detailed_indices: NDArray[np.intp]
47
48
  label_metadata: NDArray[np.int32]
48
49
 
49
50
 
@@ -569,7 +570,8 @@ class DataLoader:
569
570
  [gt.extrema, pd.extrema]
570
571
  for pd in detection.predictions
571
572
  for gt in detection.groundtruths
572
- ]
573
+ ],
574
+ dtype=np.float64,
573
575
  )
574
576
  ).reshape(len(detection.predictions), len(detection.groundtruths))
575
577
  for detection in detections
@@ -2,6 +2,7 @@ from collections import defaultdict
2
2
 
3
3
  import numpy as np
4
4
  from numpy.typing import NDArray
5
+
5
6
  from valor_lite.object_detection.metric import Metric, MetricType
6
7
 
7
8
 
@@ -136,10 +137,8 @@ def unpack_precision_recall_into_metric_lists(
136
137
 
137
138
  metrics[MetricType.PrecisionRecallCurve] = [
138
139
  Metric.precision_recall_curve(
139
- precisions=pr_curves[iou_idx, label_idx, :, 0]
140
- .astype(float)
141
- .tolist(),
142
- scores=pr_curves[iou_idx, label_idx, :, 1].astype(float).tolist(),
140
+ precisions=pr_curves[iou_idx, label_idx, :, 0].tolist(), # type: ignore[reportArgumentType]
141
+ scores=pr_curves[iou_idx, label_idx, :, 1].tolist(), # type: ignore[reportArgumentType]
143
142
  iou_threshold=iou_threshold,
144
143
  label=label,
145
144
  )
@@ -4,6 +4,7 @@ from dataclasses import dataclass
4
4
  import numpy as np
5
5
  from numpy.typing import NDArray
6
6
  from tqdm import tqdm
7
+
7
8
  from valor_lite.semantic_segmentation.annotation import Segmentation
8
9
  from valor_lite.semantic_segmentation.computation import (
9
10
  compute_intermediate_confusion_matrices,
@@ -37,7 +38,7 @@ filtered_metrics = evaluator.evaluate(filter_mask=filter_mask)
37
38
 
38
39
  @dataclass
39
40
  class Filter:
40
- indices: NDArray[np.int32]
41
+ indices: NDArray[np.intp]
41
42
  label_metadata: NDArray[np.int32]
42
43
  n_pixels: int
43
44
 
@@ -2,6 +2,7 @@ from collections import defaultdict
2
2
 
3
3
  import numpy as np
4
4
  from numpy.typing import NDArray
5
+
5
6
  from valor_lite.semantic_segmentation.metric import Metric, MetricType
6
7
 
7
8
 
@@ -1,6 +1,7 @@
1
1
  import evaluate
2
2
  from nltk.tokenize import RegexpTokenizer
3
3
  from nltk.translate import bleu_score
4
+
4
5
  from valor_lite.text_generation.llm.generation import (
5
6
  generate_answer_correctness_verdicts,
6
7
  generate_answer_relevance_verdicts,
@@ -1,42 +1,16 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: valor-lite
3
- Version: 0.33.19
4
- Summary: Compute valor metrics locally.
5
- License: MIT License
6
-
7
- Copyright (c) 2023 Striveworks
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy
10
- of this software and associated documentation files (the "Software"), to deal
11
- in the Software without restriction, including without limitation the rights
12
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- copies of the Software, and to permit persons to whom the Software is
14
- furnished to do so, subject to the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be included in all
17
- copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
- SOFTWARE.
26
-
3
+ Version: 0.34.0
4
+ Summary: Evaluate machine learning models.
27
5
  Project-URL: homepage, https://www.striveworks.com
28
6
  Requires-Python: >=3.10
29
7
  Description-Content-Type: text/markdown
30
- License-File: LICENSE
8
+ Requires-Dist: numpy
9
+ Requires-Dist: tqdm
10
+ Requires-Dist: shapely
31
11
  Requires-Dist: evaluate
32
- Requires-Dist: importlib_metadata; python_version < "3.8"
33
12
  Requires-Dist: nltk
34
- Requires-Dist: numpy
35
- Requires-Dist: Pillow>=9.1.0
36
- Requires-Dist: requests
37
13
  Requires-Dist: rouge_score
38
- Requires-Dist: shapely
39
- Requires-Dist: tqdm
40
14
  Provides-Extra: mistral
41
15
  Requires-Dist: mistralai>=1.0; extra == "mistral"
42
16
  Provides-Extra: openai
@@ -45,6 +19,15 @@ Provides-Extra: test
45
19
  Requires-Dist: pytest; extra == "test"
46
20
  Requires-Dist: coverage; extra == "test"
47
21
  Requires-Dist: pre-commit; extra == "test"
22
+ Provides-Extra: docs
23
+ Requires-Dist: mkdocs; extra == "docs"
24
+ Requires-Dist: mkdocs-material; extra == "docs"
25
+ Requires-Dist: mkdocstrings; extra == "docs"
26
+ Requires-Dist: mkdocstrings-python; extra == "docs"
27
+ Requires-Dist: mkdocs-include-dir-to-nav; extra == "docs"
28
+ Requires-Dist: mkdocs-swagger-ui-tag; extra == "docs"
29
+ Provides-Extra: dev
30
+ Requires-Dist: valor-lite[docs,mistral,openai,test]; extra == "dev"
48
31
 
49
32
  # valor-lite: Fast, local machine learning evaluation.
50
33
 
@@ -4,26 +4,26 @@ valor_lite/profiling.py,sha256=TLIROA1qccFw9NoEkMeQcrvvGGO75c4K5yTIWoCUix8,11746
4
4
  valor_lite/schemas.py,sha256=pB0MrPx5qFLbwBWDiOUUm-vmXdWvbJLFCBmKgbcbI5g,198
5
5
  valor_lite/classification/__init__.py,sha256=8MI8bGwCxYGqRP7KxG7ezhYv4qQ5947XGvvlF8WPM5g,392
6
6
  valor_lite/classification/annotation.py,sha256=0aUOvcwBAZgiNOJuyh-pXyNTG7vP7r8CUfnU3OmpUwQ,1113
7
- valor_lite/classification/computation.py,sha256=XU-55bzR2JPKDRr8CvCbHHavM5vjBw1TrUX1mOIm_TY,12121
8
- valor_lite/classification/manager.py,sha256=8GXZECSx4CBbG5NfPrA19BPENqmrjo-wZBmaulWHY20,16676
7
+ valor_lite/classification/computation.py,sha256=dOcq1xxarwwwtHya1Wl8KZXE-PoGafOAYK0LQqxGphY,12191
8
+ valor_lite/classification/manager.py,sha256=cZ6-DKao59QqF0JF_U26tBoydpCElAAH8rRyX_Kc6bc,16618
9
9
  valor_lite/classification/metric.py,sha256=_mW3zynmpW8jUIhK2OeX4usdftHgHM9_l7EAbEe2N3w,12288
10
- valor_lite/classification/utilities.py,sha256=7P3H2wsUR_qmK4WJBFPkViOvhhKVMkCHvDKJbeentMM,6963
10
+ valor_lite/classification/utilities.py,sha256=eG-Qhd213uf2GXuuqsPxCgBRBFV-z_ADbzneF1kE368,6964
11
11
  valor_lite/object_detection/__init__.py,sha256=Ql8rju2q7y0Zd9zFvtBJDRhgQFDm1RSYkTsyH3ZE6pA,648
12
12
  valor_lite/object_detection/annotation.py,sha256=x9bsl8b75yvkMByXXiIYI9d9T03olDqtykSvKJc3aFw,7729
13
- valor_lite/object_detection/computation.py,sha256=70XkgyxAbvZC8FcTKqdAATD5Muebw_jGjoTKPaecwjE,28141
14
- valor_lite/object_detection/manager.py,sha256=utdILUUCx04EWC0_bHGpEPaxcCOhmsOx5lxT9qU1a9s,23033
13
+ valor_lite/object_detection/computation.py,sha256=Q9sFMQhRupseZmGZzA7uEpqpeo9XpmSIkeKGMNEZfP4,28345
14
+ valor_lite/object_detection/manager.py,sha256=wjjMvzCoWs5oavtSj1NT-o4QFT5Sqf79WIb_OO64y1o,23071
15
15
  valor_lite/object_detection/metric.py,sha256=npK2sxiwCUTKlRlFym1AlZTvP9herf9lakbsBDwljGM,24901
16
- valor_lite/object_detection/utilities.py,sha256=F0sfhkledX3h3jXLDpLro7zHbUF9ig7r35J7QbogQVY,16437
16
+ valor_lite/object_detection/utilities.py,sha256=42RRyP6L3eWtDY_f7qs7f0WTjhcibmUBu2I4yAwupF0,16456
17
17
  valor_lite/semantic_segmentation/__init__.py,sha256=BhTUbwbdJa1FdS4ZA3QSIZ8TuJmdGGLGCd5hX6SzKa4,297
18
18
  valor_lite/semantic_segmentation/annotation.py,sha256=xd2qJyIeTW8CT_Goyu3Kvl_51b9b6D3WvUfqwShR0Sk,4990
19
19
  valor_lite/semantic_segmentation/benchmark.py,sha256=iVdxUo9LgDbbXUa6eRhZ49LOYw-yyr2W4p9FP3KHg0k,3848
20
20
  valor_lite/semantic_segmentation/computation.py,sha256=l98h8s9RTWQOB_eg2rconqGL1ZbTS4GMtz69vbyEdQ0,4741
21
- valor_lite/semantic_segmentation/manager.py,sha256=TtwJI7Bsn3zHL2ECOqCmymG-JqREo7I6qxYtycbz54Y,14322
21
+ valor_lite/semantic_segmentation/manager.py,sha256=p0RuV27S1NTBeYZD6G9dSdOcl3yuRLrjL_SMUjEgRXE,14322
22
22
  valor_lite/semantic_segmentation/metric.py,sha256=T9RfPJf4WgqGQTXYvSy08vJG5bjXXJnyYZeW0mlxMa8,7132
23
- valor_lite/semantic_segmentation/utilities.py,sha256=y9SgArhrk-u_r54SgQxGEKrDjow5KvPG8Zj1GeZefqY,2958
23
+ valor_lite/semantic_segmentation/utilities.py,sha256=UD0X-iCWMR8Rmw2YaP4HM3lxwhYwo-yNGzF-taAJ8RA,2959
24
24
  valor_lite/text_generation/__init__.py,sha256=pGhpWCSZjLM0pPHCtPykAfos55B8ie3mi9EzbNxfj-U,356
25
25
  valor_lite/text_generation/annotation.py,sha256=O5aXiwCS4WjA-fqn4ly-O0MsTHoIOmqxqCaAp9IeI3M,1270
26
- valor_lite/text_generation/computation.py,sha256=cG35qMpxNPEYHXN2fz8wcanESriSHoWMl1idpm9-ous,18638
26
+ valor_lite/text_generation/computation.py,sha256=vdZTajB0OuGEwoKWxKkq3lWxlPaUsrp_X5-ZgjkYLhg,18639
27
27
  valor_lite/text_generation/manager.py,sha256=C4QwvronGHXmYSkaRmUGy7TN0C0aeyDx9Hb-ClNYXK4,24810
28
28
  valor_lite/text_generation/metric.py,sha256=C9gbWejjOJ23JVLecuUhYW5rkx30NUCfRtgsM46uMds,10409
29
29
  valor_lite/text_generation/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -33,8 +33,7 @@ valor_lite/text_generation/llm/instructions.py,sha256=fz2onBZZWcl5W8iy7zEWkPGU9N
33
33
  valor_lite/text_generation/llm/integrations.py,sha256=-rTfdAjq1zH-4ixwYuMQEOQ80pIFzMTe0BYfroVx3Pg,6974
34
34
  valor_lite/text_generation/llm/utilities.py,sha256=bjqatGgtVTcl1PrMwiDKTYPGJXKrBrx7PDtzIblGSys,1178
35
35
  valor_lite/text_generation/llm/validators.py,sha256=Wzr5RlfF58_2wOU-uTw7C8skan_fYdhy4Gfn0jSJ8HM,2700
36
- valor_lite-0.33.19.dist-info/LICENSE,sha256=M0L53VuwfEEqezhHb7NPeYcO_glw7-k4DMLZQ3eRN64,1068
37
- valor_lite-0.33.19.dist-info/METADATA,sha256=lwmxYzLPlKkCZM0mVkepQYYy4mjbg34UEOeeqM7ZE2k,5880
38
- valor_lite-0.33.19.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
39
- valor_lite-0.33.19.dist-info/top_level.txt,sha256=9ujykxSwpl2Hu0_R95UQTR_l07k9UUTSdrpiqmq6zc4,11
40
- valor_lite-0.33.19.dist-info/RECORD,,
36
+ valor_lite-0.34.0.dist-info/METADATA,sha256=2l5zKt0RkVHbdYmC1kLF71rG_dKZnZQ-XyuAQGf7dTg,4908
37
+ valor_lite-0.34.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
38
+ valor_lite-0.34.0.dist-info/top_level.txt,sha256=9ujykxSwpl2Hu0_R95UQTR_l07k9UUTSdrpiqmq6zc4,11
39
+ valor_lite-0.34.0.dist-info/RECORD,,
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Striveworks
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.