JABS Core Enums
Module for defining enums used in JABS
CacheFormat
ClassifierMode
ConfidenceMetric
CrossValidationGroupingStrategy
Method
PredictionType
Bases: IntEnum
Enum describing a prediction type.
RAW: Raw model output. POSTPROCESSED: Post-processed model output.
ProjectDistanceUnit
SamplingStrategy
StorageFormat
compile_grouping_regex(regex)
Compile a filename-pattern cross-validation grouping regular expression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
regex
|
str
|
Regular expression used to extract a grouping key from a video filename. |
required |
Returns:
| Type | Description |
|---|---|
Pattern[str]
|
The compiled regular expression pattern. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
filename_group_key(video_name, pattern)
Extract a cross-validation grouping key from a video filename.
The pattern is applied with :meth:re.Pattern.search, so it matches anywhere
in video_name. If the pattern defines a capturing group and it matched, the
first captured group is used as the key (so a pattern that captures the digits
in cage_1234.mp4 yields "1234"); otherwise the full matched text is used
(a pattern matching the whole cage_1234 token yields "cage_1234").
Videos that do not match the pattern are placed in their own group, keyed by the
filename itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video_name
|
str
|
Video filename to extract a grouping key from. |
required |
pattern
|
Pattern[str]
|
Compiled regular expression (see :func: |
required |
Returns:
| Type | Description |
|---|---|
str
|
The grouping key string. All videos that yield the same key are placed in |
str
|
the same cross-validation group. |