arthurai.core.models.ArthurModelGroup#
- class arthurai.core.models.ArthurModelGroup(id=None, name=<property object>, description=<property object>, archived=False, created_at=None, updated_at=None, client=None)#
Bases:
arthurai.core.base.ArthurBaseJsonDataclass
(BETA) The ArthurModelGroup class is a collection of the metadata which represents a group of models within a Model Group on the Arthur platform.
- Parameters
id – The auto-generated unique UUID for the model. Will be overwritten if set by the user.
name – An optional display name for the model.
description – An optional description of the model.
archived – Indicates whether or not a model has been archived, defaults to False.
created_at – UTC timestamp in ISO8601 format of when the model was created. Will be overwritten if set by the user.
updated_at – UTC timestamp in ISO8601 format of when the model was last updated. Will be overwritten if set by the user.
client –
arthurai.client.Client
object which manages data storage
Methods
(BETA) Adds an unsaved ArthurModel as a version of this model group by setting the model_group_id of the ArthurModel.
(BETA) Calls the endpoint to archive the model group and all of its models async with a DELETE request.
Helper function to filter out None objects from a json or dictionary representation of an object
from_dict
- rtype
TypeVar
(A
, bound=DataClassJsonMixin
)
from_json
- rtype
TypeVar
(A
, bound=DataClassJsonMixin
)
(BETA) Retrieves the ArthurModel marked as the latest saved version of this model group.
(BETA) Retrieves a saved model within the model group that matches the unique target sequence_num or label, but not both.
(BETA) Retrieve all saved model versions from the model group as a list of ArthurModels.
schema
- rtype
SchemaF
[TypeVar
(A
)]
Creates a dictionary representation of this object
Creates a json representation of this object
(BETA) Returns a DataVisualizer object for the model versions in the group.
Attributes
archived
client
created_at
dataclass_json_config
(BETA) Property getter for the ArthurModelGroup's description.
id
(BETA) Property getter for the ArthurModelGroup's name.
updated_at
- add_version(model, label=None)#
(BETA) Adds an unsaved ArthurModel as a version of this model group by setting the model_group_id of the ArthurModel.
- Parameters
model (
ArthurModel
) – ArthurModel object to add to this model group.label (
Optional
[str
]) – Optional string label to apply to this model.
- Return type
None
- Returns
None.
- Raises
UserValueError – If neither sequence_num nor label are provided, or if both are.
- archive()#
(BETA) Calls the endpoint to archive the model group and all of its models async with a DELETE request. The request can still fail async if one of the models in the group cannot be deleted.
- Return type
None
- Returns
None
- Raises
Exception – the model group has no ID or the model group archive request was not accepted
- Permissions
model_group delete
- static clean_nones(d)#
Helper function to filter out None objects from a json or dictionary representation of an object
- Parameters
d – a Dictionary or Json representation of an ArthurBaseJsonDataclass object
- Returns
Dictionary of the object with all None components removed
- property description: Optional[str]#
(BETA) Property getter for the ArthurModelGroup’s description.
- Return type
Optional
[str
]- Returns
String description if one has been set, else None.
- get_latest_version(include_archived=False)#
(BETA) Retrieves the ArthurModel marked as the latest saved version of this model group.
- Parameters
include_archived (
bool
) – By default, only unarchived models will be retrieved, but if include_archived is True, all models from the group (archived or not) will be retrieved.- Return type
- Returns
Latest ArthurModel saved as version of this model group.
- Permissions
model_group read
- get_version(sequence_num=None, label=None, include_archived=False)#
(BETA) Retrieves a saved model within the model group that matches the unique target sequence_num or label, but not both. Exactly one or the other must be provided.
- Parameters
sequence_num (
Optional
[int
]) – version_sequence_num of the model version to retrieve from the group. Required if label is not specified.label (
Optional
[str
]) – version_label of the model version to retrieve from the group. Required if sequence_num is not specified.
- Return type
- Returns
ArthurModel if a model exists that fits the search parameters.
- Raises
UserValueError – If neither sequence_num nor label are provided, or if both are.
UserTypeError – If the provided query parameter is not of the expected type.
ResponseClientError – If no such version exists within the model group. e.g. 404 Not Found: {‘error’: ‘record not found’}
ArthurUserError – failed due to user error
ArthurInternalError – failed due to an internal error
- Permissions
model_group read
- get_versions(include_archived=False)#
(BETA) Retrieve all saved model versions from the model group as a list of ArthurModels. This will only return models already onboarded to the Arthur platform.
- Parameters
include_archived (
bool
) – By default, only unarchived models will be retrieved, but if include_archived is True, all models from the group (archived or not) will be retrieved.- Return type
List
[ArthurModel
]- Returns
List of all model versions saved to the Arthur platform.
- Permissions
model_group read
- property name: Optional[str]#
(BETA) Property getter for the ArthurModelGroup’s name.
- Return type
Optional
[str
]- Returns
String name if one has been set, else None.
- to_dict(skip_none=True)#
Creates a dictionary representation of this object
This function can be applied to any extension of the ArthurBaseJsonDataClass
- Return type
dict
- Returns
Dictionary of object data
- to_json(skip_none=True)#
Creates a json representation of this object
This function can be applied to any extension of the ArthurBaseJsonDataClass
- Return type
str
- Returns
json of object data
- viz(sequence_nums=None, labels=None)#
(BETA) Returns a DataVisualizer object for the model versions in the group. A subset of model versions can be specified with a list of version sequence nums or version labels, but both cannot be specified as an exception will be raised.
- Parameters
sequence_nums (
Optional
[List
[int
]]) – Specific version sequence nums to specify a subset of model versions in the group.labels (
Optional
[List
[str
]]) – Specific version labels to specify a subset of model versions in the group.
- Return type
- Returns
DataVisualizer for models specified.