module documentation
Undocumented
| Function | check |
Ensure that a dataset exists in the selected storage. |
| Function | complete |
Undocumented |
| Function | get |
Undocumented |
| Function | parse |
Parse a CLI split-ratio argument. |
| Function | print |
Undocumented |
Ensure that a dataset exists in the selected storage.
| Parameters | |
name:str | Dataset name. |
bucketBucketStorage | Storage backend to query. |
| Raises | |
typer.Exit | If the dataset does not exist. |
def parse_split_ratio(value:
str | None = None, train: float | None = None, val: float | None = None, test: float | None = None) -> dict[ str, float | int] | None:
¶
Parse a CLI split-ratio argument.
Float lists represent ratios and must sum to 1.0. Integer lists represent absolute counts.
Example
>>> parse_split_ratio("[0.7, 0.2, 0.1]") {'train': 0.7, 'val': 0.2, 'test': 0.1} >>> parse_split_ratio(train=70, val=20, test=10) {'train': 70, 'val': 20, 'test': 10} >>> parse_split_ratio(train=0.7, val=0.2) {'train': 0.7, 'val': 0.2, 'test': 0.1} >>> parse_split_ratio(train=0.7, val=0.2, test=0.1) {'train': 0.7, 'val': 0.2, 'test': 0.1} >>> parse_split_ratio([10, 27]) Traceback (most recent call last): ... ValueError: Split ratio must be a list of 3 values (train, val, test). >>> parse_split_ratio(train=0.7, val=0.2, test=0.2) Traceback (most recent call last): ... ValueError: Split ratios must sum to 1.0; use whole numbers for counts.
| Parameters | |
value:str | None | A string representation of a list of 3 values (train, val, test). |
train:float | None | Optional float or int for training split. |
val:float | None | Optional float or int for validation split. |
test:float | None | Optional float or int for test split. |
| Returns | |
dict[ | A dictionary with keys "train", "val", and "test" mapping to their respective ratios or counts, or None if no values were provided. |
| Raises | |
ValueError | If the input format is invalid, if ratios don't sum to 1.0, |
or if there's a mix of counts and ratios. | |