valor-lite 0.33.19__tar.gz → 0.34.0__tar.gz

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.

Files changed (126) hide show
  1. {valor_lite-0.33.19/valor_lite.egg-info → valor_lite-0.34.0}/PKG-INFO +14 -31
  2. {valor_lite-0.33.19 → valor_lite-0.34.0}/pyproject.toml +13 -7
  3. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/classification/computation.py +7 -5
  4. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/classification/manager.py +3 -3
  5. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/classification/utilities.py +1 -0
  6. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/object_detection/computation.py +16 -12
  7. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/object_detection/manager.py +5 -3
  8. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/object_detection/utilities.py +3 -4
  9. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/semantic_segmentation/manager.py +2 -1
  10. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/semantic_segmentation/utilities.py +1 -0
  11. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/text_generation/computation.py +1 -0
  12. {valor_lite-0.33.19 → valor_lite-0.34.0/valor_lite.egg-info}/PKG-INFO +14 -31
  13. valor_lite-0.34.0/valor_lite.egg-info/SOURCES.txt +42 -0
  14. valor_lite-0.34.0/valor_lite.egg-info/requires.txt +28 -0
  15. valor_lite-0.33.19/benchmarks/.gitignore +0 -2
  16. valor_lite-0.33.19/benchmarks/benchmark_classification.py +0 -272
  17. valor_lite-0.33.19/benchmarks/benchmark_objdet.py +0 -410
  18. valor_lite-0.33.19/benchmarks/synthetic/benchmark_semantic_segmentation.py +0 -94
  19. valor_lite-0.33.19/examples/.gitignore +0 -1
  20. valor_lite-0.33.19/examples/benchmarking.ipynb +0 -279
  21. valor_lite-0.33.19/examples/object-detection.ipynb +0 -3023
  22. valor_lite-0.33.19/examples/tabular_classification.ipynb +0 -633
  23. valor_lite-0.33.19/examples/text_generation.ipynb +0 -500
  24. valor_lite-0.33.19/tests/classification/conftest.py +0 -331
  25. valor_lite-0.33.19/tests/classification/test_accuracy.py +0 -226
  26. valor_lite-0.33.19/tests/classification/test_confusion_matrix.py +0 -618
  27. valor_lite-0.33.19/tests/classification/test_counts.py +0 -1318
  28. valor_lite-0.33.19/tests/classification/test_dataloader.py +0 -18
  29. valor_lite-0.33.19/tests/classification/test_evaluator.py +0 -64
  30. valor_lite-0.33.19/tests/classification/test_f1.py +0 -394
  31. valor_lite-0.33.19/tests/classification/test_filtering.py +0 -570
  32. valor_lite-0.33.19/tests/classification/test_metric.py +0 -39
  33. valor_lite-0.33.19/tests/classification/test_precision.py +0 -392
  34. valor_lite-0.33.19/tests/classification/test_recall.py +0 -327
  35. valor_lite-0.33.19/tests/classification/test_rocauc.py +0 -396
  36. valor_lite-0.33.19/tests/classification/test_schemas.py +0 -30
  37. valor_lite-0.33.19/tests/classification/test_stability.py +0 -70
  38. valor_lite-0.33.19/tests/object_detection/__init__.py +0 -0
  39. valor_lite-0.33.19/tests/object_detection/conftest.py +0 -1123
  40. valor_lite-0.33.19/tests/object_detection/test_accuracy.py +0 -483
  41. valor_lite-0.33.19/tests/object_detection/test_average_precision.py +0 -854
  42. valor_lite-0.33.19/tests/object_detection/test_average_recall.py +0 -604
  43. valor_lite-0.33.19/tests/object_detection/test_confusion_matrix.py +0 -1799
  44. valor_lite-0.33.19/tests/object_detection/test_counts.py +0 -601
  45. valor_lite-0.33.19/tests/object_detection/test_dataloader.py +0 -144
  46. valor_lite-0.33.19/tests/object_detection/test_evaluator.py +0 -130
  47. valor_lite-0.33.19/tests/object_detection/test_f1.py +0 -470
  48. valor_lite-0.33.19/tests/object_detection/test_filtering.py +0 -586
  49. valor_lite-0.33.19/tests/object_detection/test_iou.py +0 -371
  50. valor_lite-0.33.19/tests/object_detection/test_metric.py +0 -39
  51. valor_lite-0.33.19/tests/object_detection/test_pr_curve.py +0 -234
  52. valor_lite-0.33.19/tests/object_detection/test_precision.py +0 -470
  53. valor_lite-0.33.19/tests/object_detection/test_recall.py +0 -469
  54. valor_lite-0.33.19/tests/object_detection/test_schemas.py +0 -160
  55. valor_lite-0.33.19/tests/object_detection/test_stability.py +0 -103
  56. valor_lite-0.33.19/tests/semantic_segmentation/__init__.py +0 -0
  57. valor_lite-0.33.19/tests/semantic_segmentation/conftest.py +0 -132
  58. valor_lite-0.33.19/tests/semantic_segmentation/test_accuracy.py +0 -67
  59. valor_lite-0.33.19/tests/semantic_segmentation/test_annotation.py +0 -136
  60. valor_lite-0.33.19/tests/semantic_segmentation/test_confusion_matrix.py +0 -153
  61. valor_lite-0.33.19/tests/semantic_segmentation/test_dataloader.py +0 -8
  62. valor_lite-0.33.19/tests/semantic_segmentation/test_evaluator.py +0 -66
  63. valor_lite-0.33.19/tests/semantic_segmentation/test_f1.py +0 -94
  64. valor_lite-0.33.19/tests/semantic_segmentation/test_filtering.py +0 -75
  65. valor_lite-0.33.19/tests/semantic_segmentation/test_iou.py +0 -125
  66. valor_lite-0.33.19/tests/semantic_segmentation/test_metric.py +0 -39
  67. valor_lite-0.33.19/tests/semantic_segmentation/test_precision.py +0 -96
  68. valor_lite-0.33.19/tests/semantic_segmentation/test_recall.py +0 -94
  69. valor_lite-0.33.19/tests/semantic_segmentation/test_stability.py +0 -85
  70. valor_lite-0.33.19/tests/text_generation/__init__.py +0 -0
  71. valor_lite-0.33.19/tests/text_generation/conftest.py +0 -240
  72. valor_lite-0.33.19/tests/text_generation/llm/__init__.py +0 -0
  73. valor_lite-0.33.19/tests/text_generation/llm/test_generation.py +0 -140
  74. valor_lite-0.33.19/tests/text_generation/llm/test_integrations.py +0 -364
  75. valor_lite-0.33.19/tests/text_generation/llm/test_utilities.py +0 -83
  76. valor_lite-0.33.19/tests/text_generation/llm/test_validators.py +0 -107
  77. valor_lite-0.33.19/tests/text_generation/metrics/test_answer_correctness.py +0 -87
  78. valor_lite-0.33.19/tests/text_generation/metrics/test_answer_relevance.py +0 -109
  79. valor_lite-0.33.19/tests/text_generation/metrics/test_bias.py +0 -104
  80. valor_lite-0.33.19/tests/text_generation/metrics/test_context_precision.py +0 -195
  81. valor_lite-0.33.19/tests/text_generation/metrics/test_context_recall.py +0 -194
  82. valor_lite-0.33.19/tests/text_generation/metrics/test_context_relevance.py +0 -135
  83. valor_lite-0.33.19/tests/text_generation/metrics/test_faithfulness.py +0 -155
  84. valor_lite-0.33.19/tests/text_generation/metrics/test_hallucination.py +0 -118
  85. valor_lite-0.33.19/tests/text_generation/metrics/test_metric.py +0 -39
  86. valor_lite-0.33.19/tests/text_generation/metrics/test_rouge.py +0 -242
  87. valor_lite-0.33.19/tests/text_generation/metrics/test_sentence_bleu.py +0 -224
  88. valor_lite-0.33.19/tests/text_generation/metrics/test_summary_coherence.py +0 -88
  89. valor_lite-0.33.19/tests/text_generation/metrics/test_toxicity.py +0 -105
  90. valor_lite-0.33.19/tests/text_generation/test_evaluator.py +0 -170
  91. valor_lite-0.33.19/tests/text_generation/test_manager.py +0 -110
  92. valor_lite-0.33.19/valor_lite/LICENSE +0 -21
  93. valor_lite-0.33.19/valor_lite/__init__.py +0 -0
  94. valor_lite-0.33.19/valor_lite/text_generation/llm/__init__.py +0 -0
  95. valor_lite-0.33.19/valor_lite.egg-info/SOURCES.txt +0 -122
  96. valor_lite-0.33.19/valor_lite.egg-info/requires.txt +0 -22
  97. {valor_lite-0.33.19 → valor_lite-0.34.0}/README.md +0 -0
  98. {valor_lite-0.33.19 → valor_lite-0.34.0}/setup.cfg +0 -0
  99. {valor_lite-0.33.19 → valor_lite-0.34.0/valor_lite}/LICENSE +0 -0
  100. {valor_lite-0.33.19/tests → valor_lite-0.34.0/valor_lite}/__init__.py +0 -0
  101. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/classification/__init__.py +0 -0
  102. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/classification/annotation.py +0 -0
  103. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/classification/metric.py +0 -0
  104. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/object_detection/__init__.py +0 -0
  105. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/object_detection/annotation.py +0 -0
  106. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/object_detection/metric.py +0 -0
  107. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/profiling.py +0 -0
  108. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/schemas.py +0 -0
  109. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/semantic_segmentation/__init__.py +0 -0
  110. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/semantic_segmentation/annotation.py +0 -0
  111. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/semantic_segmentation/benchmark.py +0 -0
  112. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/semantic_segmentation/computation.py +0 -0
  113. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/semantic_segmentation/metric.py +0 -0
  114. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/text_generation/__init__.py +0 -0
  115. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/text_generation/annotation.py +0 -0
  116. {valor_lite-0.33.19/tests/classification → valor_lite-0.34.0/valor_lite/text_generation/llm}/__init__.py +0 -0
  117. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/text_generation/llm/exceptions.py +0 -0
  118. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/text_generation/llm/generation.py +0 -0
  119. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/text_generation/llm/instructions.py +0 -0
  120. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/text_generation/llm/integrations.py +0 -0
  121. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/text_generation/llm/utilities.py +0 -0
  122. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/text_generation/llm/validators.py +0 -0
  123. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/text_generation/manager.py +0 -0
  124. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite/text_generation/metric.py +0 -0
  125. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite.egg-info/dependency_links.txt +0 -0
  126. {valor_lite-0.33.19 → valor_lite-0.34.0}/valor_lite.egg-info/top_level.txt +0 -0
@@ -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
 
@@ -1,20 +1,17 @@
1
1
  [project]
2
2
  name = "valor-lite"
3
3
  dynamic = ["version"]
4
- description = "Compute valor metrics locally."
4
+ description = "Evaluate machine learning models."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
7
7
  license = { file = "LICENSE" }
8
8
  dependencies = [
9
+ "numpy",
10
+ "tqdm",
11
+ "shapely",
9
12
  "evaluate",
10
- "importlib_metadata; python_version < '3.8'",
11
13
  "nltk",
12
- "numpy",
13
- "Pillow >= 9.1.0",
14
- "requests",
15
14
  "rouge_score",
16
- "shapely",
17
- "tqdm",
18
15
  ]
19
16
 
20
17
  [project.urls]
@@ -28,6 +25,15 @@ build-backend = "setuptools.build_meta"
28
25
  mistral = ["mistralai >= 1.0"]
29
26
  openai = ["openai"]
30
27
  test = ["pytest", "coverage", "pre-commit"]
28
+ docs = [
29
+ "mkdocs",
30
+ "mkdocs-material",
31
+ "mkdocstrings",
32
+ "mkdocstrings-python",
33
+ "mkdocs-include-dir-to-nav",
34
+ "mkdocs-swagger-ui-tag",
35
+ ]
36
+ dev = ["valor-lite[openai, mistral, test, docs]"]
31
37
 
32
38
  [tool.black]
33
39
  line-length = 79
@@ -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
 
@@ -0,0 +1,42 @@
1
+ README.md
2
+ pyproject.toml
3
+ valor_lite/LICENSE
4
+ valor_lite/__init__.py
5
+ valor_lite/profiling.py
6
+ valor_lite/schemas.py
7
+ valor_lite.egg-info/PKG-INFO
8
+ valor_lite.egg-info/SOURCES.txt
9
+ valor_lite.egg-info/dependency_links.txt
10
+ valor_lite.egg-info/requires.txt
11
+ valor_lite.egg-info/top_level.txt
12
+ valor_lite/classification/__init__.py
13
+ valor_lite/classification/annotation.py
14
+ valor_lite/classification/computation.py
15
+ valor_lite/classification/manager.py
16
+ valor_lite/classification/metric.py
17
+ valor_lite/classification/utilities.py
18
+ valor_lite/object_detection/__init__.py
19
+ valor_lite/object_detection/annotation.py
20
+ valor_lite/object_detection/computation.py
21
+ valor_lite/object_detection/manager.py
22
+ valor_lite/object_detection/metric.py
23
+ valor_lite/object_detection/utilities.py
24
+ valor_lite/semantic_segmentation/__init__.py
25
+ valor_lite/semantic_segmentation/annotation.py
26
+ valor_lite/semantic_segmentation/benchmark.py
27
+ valor_lite/semantic_segmentation/computation.py
28
+ valor_lite/semantic_segmentation/manager.py
29
+ valor_lite/semantic_segmentation/metric.py
30
+ valor_lite/semantic_segmentation/utilities.py
31
+ valor_lite/text_generation/__init__.py
32
+ valor_lite/text_generation/annotation.py
33
+ valor_lite/text_generation/computation.py
34
+ valor_lite/text_generation/manager.py
35
+ valor_lite/text_generation/metric.py
36
+ valor_lite/text_generation/llm/__init__.py
37
+ valor_lite/text_generation/llm/exceptions.py
38
+ valor_lite/text_generation/llm/generation.py
39
+ valor_lite/text_generation/llm/instructions.py
40
+ valor_lite/text_generation/llm/integrations.py
41
+ valor_lite/text_generation/llm/utilities.py
42
+ valor_lite/text_generation/llm/validators.py
@@ -0,0 +1,28 @@
1
+ numpy
2
+ tqdm
3
+ shapely
4
+ evaluate
5
+ nltk
6
+ rouge_score
7
+
8
+ [dev]
9
+ valor-lite[docs,mistral,openai,test]
10
+
11
+ [docs]
12
+ mkdocs
13
+ mkdocs-material
14
+ mkdocstrings
15
+ mkdocstrings-python
16
+ mkdocs-include-dir-to-nav
17
+ mkdocs-swagger-ui-tag
18
+
19
+ [mistral]
20
+ mistralai>=1.0
21
+
22
+ [openai]
23
+ openai
24
+
25
+ [test]
26
+ pytest
27
+ coverage
28
+ pre-commit
@@ -1,2 +0,0 @@
1
- *.json
2
- *.jsonl