Convert supervision/classification/core.py docstrings to doctests
--- Co-authored-by: copilot-swe-agent[bot] <198982749+copilot@users.noreply.github.com>
This commit is contained in:
committed by
Jirka Borovec
co-authored by
copilot-swe-agent[bot]
parent
ce4204adc1
commit
ebe3fd4d2f
@@ -167,15 +167,14 @@ class Classifications:
|
||||
the top k class IDs and confidences.
|
||||
|
||||
Example:
|
||||
```python
|
||||
import supervision as sv
|
||||
|
||||
classifications = sv.Classifications(...)
|
||||
|
||||
classifications.get_top_k(1)
|
||||
|
||||
>>> import numpy as np
|
||||
>>> import supervision as sv
|
||||
>>> classifications = sv.Classifications(
|
||||
... class_id=np.array([0, 1, 2]),
|
||||
... confidence=np.array([0.3, 0.9, 0.5])
|
||||
... )
|
||||
>>> classifications.get_top_k(1)
|
||||
(array([1]), array([0.9]))
|
||||
```
|
||||
"""
|
||||
if self.confidence is None:
|
||||
raise ValueError("top_k could not be calculated, confidence is None")
|
||||
|
||||
Reference in New Issue
Block a user