Types
SplitIndicesType
module-attribute
A split is defined by a sequence of integers.
SplitType
module-attribute
SplitType: TypeAlias = tuple[SplitIndicesType, Union[SplitIndicesType, dict[str, SplitIndicesType]]]
A split is a pair of which the first item is always assumed to be the train set. The second item can either be a single test set or a dictionary with multiple, named test sets.
ListOrArrayType
module-attribute
A list of numbers or a numpy array. Predictions can be provided as either a list or a numpy array.
IncomingPredictionsType
module-attribute
IncomingPredictionsType: TypeAlias = ListOrArrayType | dict[str, ListOrArrayType | dict[str, ListOrArrayType]]
The type of the predictions that are ingested into the Polaris BenchmarkPredictions object. Can be one of the following:
- A single array (single-task, single test set)
- A dictionary of arrays (single-task, multiple test sets)
- A dictionary of dictionaries of arrays (multi-task, multiple test sets)
PredictionsType
module-attribute
The normalized format for predictions for internal use. Predictions are accepted in a generous variety of representations and normalized into this standard format, a dictionary of dictionaries that looks like {"test_set_name": {"target_name": np.ndarray}}.
DatapointType
module-attribute
A datapoint has:
- A single input or multiple inputs (either as dict or tuple)
- No target, a single target or a multiple targets (either as dict or tuple)
SlugStringType
module-attribute
SlugStringType: TypeAlias = Annotated[str, StringConstraints(pattern='^[a-z0-9-]+$', min_length=4, max_length=64)]
A URL-compatible string that can serve as slug on the hub.
SlugCompatibleStringType
module-attribute
SlugCompatibleStringType: TypeAlias = Annotated[str, StringConstraints(pattern='^[A-Za-z0-9_-]+$', min_length=4, max_length=64)]
A URL-compatible string that can be turned into a slug by the hub.
Can only use alpha-numeric characters, underscores and dashes. The string must be at least 4 and at most 64 characters long.
HubUser
module-attribute
A user on the Polaris Hub is identified by a username,
which is a SlugCompatibleStringType
.
HttpUrlString
module-attribute
A validated HTTP URL that will be turned into a string. This is useful for interactions with httpx and authlib, who have their own URL types.
AnyUrlString
module-attribute
A validated generic URL that will be turned into a string. This is useful for interactions with other libraries that expect a string.
DirectionType
module-attribute
The direction of any variable to be sorted. This can be used to sort the metric score, indicate the optmization direction of endpoint.
AccessType
module-attribute
Type to specify access to a dataset, benchmark or result in the Hub.
TimeoutTypes
module-attribute
Timeout types for specifying maximum wait times.
IOMode
module-attribute
Type to specify the mode for input/output operations (I/O) when interacting with a file or resource.
SupportedLicenseType
module-attribute
SupportedLicenseType: TypeAlias = Literal['CC-BY-4.0', 'CC-BY-SA-4.0', 'CC-BY-NC-4.0', 'CC-BY-NC-SA-4.0', 'CC0-1.0', 'MIT']
Supported license types for dataset uploads to Polaris Hub
ZarrConflictResolution
module-attribute
Type to specify which action to take when encountering existing files within a Zarr archive.
ChecksumStrategy
module-attribute
Type to specify which action to take to verify the data integrity of an artifact through a checksum.
ArtifactUrn
module-attribute
A Uniform Resource Name (URN) for an artifact on the Polaris Hub.
DatasetIndex
module-attribute
To index a dataset using square brackets, we have a few options:
- A single row, e.g. dataset[0]
- Specify a specific value, e.g. dataset[0, "col1"]
There are more exciting options we could implement, such as slicing, but this gets complex.
PredictionKwargs
module-attribute
The type of predictions expected by the metric interface.
HubOwner
Bases: BaseModel
An owner of an artifact on the Polaris Hub
The slug is most important as it is the user-facing part of this data model. The externalId and type are added to be consistent with the model returned by the Polaris Hub .
TargetType
Bases: Enum
The high-level classification of different targets.
TaskType
Bases: Enum
The high-level classification of different tasks.
ArtifactSubtype
Bases: Enum
The major artifact types which Polaris supports