anatools.anaclient.ml module¶
Machine Learning Functions
- create_ml_inference(self, datasetId, modelId, mapId=None, tags=None, workspaceId=None)¶
- Create a new machine learning inference job. - Parameters
- datasetId (str) – Dataset ID 
- modelId (str) – Model ID 
- mapId (str) – Map ID 
- workspaceId (str) – Workspace ID 
 
- Returns
- Inference ID 
- Return type
- str 
 
- create_ml_model(self, datasetId, architectureId, name, parameters, description=None, tags=None, workspaceId=None)¶
- Creates a new machine learning model. - Parameters
- architectureId (str) – Architecture ID 
- datasetId (str) – Dataset ID 
- name (str) – Model name 
- description (str) – Model description 
- paramters (str) – JSON string of model parameters 
- workspaceId (str) – Workspace ID 
 
- Returns
- Machine learning model ID 
- Return type
- str 
 
- delete_ml_inference(self, inferenceId, workspaceId=None)¶
- Deletes or cancels a machine learning inference job. - Parameters
- inferenceId (str) – Inference ID 
- workspaceId (str) – Workspace ID 
 
- Returns
- Returns True if successful 
- Return type
- bool 
 
- delete_ml_model(self, modelId, workspaceId=None)¶
- Deletes or cancels a machine learning training job. - Parameters
- modelId (str) – Model ID 
- workspaceId (str) – Workspace ID 
 
- Returns
- Returns True if successful 
- Return type
- bool 
 
- download_ml_inference(self, inferenceId, localDir=None, workspaceId=None)¶
- Download the inference detections. - Parameters
- inferencId (str) – Inference ID 
- localDir (str) – Local directory to save the model 
- workspaceId (str) – Workspace ID 
 
- Returns
- Returns the filename of the downloaded model 
- Return type
- str 
 
- download_ml_model(self, modelId, checkpoint=None, localDir=None, workspaceId=None)¶
- Download the machine learning model. - Parameters
- modelId (str) – Model ID 
- checkpoint (str) – Checkpoint to download. If not specified, the final model will be downloaded 
- localDir (str) – Local directory to save the model 
- workspaceId (str) – Workspace ID 
 
- Returns
- Returns the filename of the downloaded model 
- Return type
- str 
 
- edit_ml_inference(self, inferenceId, tags=None, workspaceId=None)¶
- Edit the tags of a machine learning inference job. - Parameters
- inferenceId (str) – Inference ID 
- tags (list[str]) – Tags to add or remove 
- workspaceId (str) – Workspace ID 
 
- Returns
- Returns True if successful 
- Return type
- bool 
 
- edit_ml_model(self, modelId, name=None, description=None, tags=None, workspaceId=None)¶
- Edit the name or description of a machine learning model. - Parameters
- modelId (str) – Model ID 
- name (str) – Model name 
- description (str) – Model description 
- tags (list[str]) – Model tags 
- workspaceId (str) – Workspace ID 
 
- Returns
- Returns True if successful 
- Return type
- bool 
 
- get_ml_architectures(self, fields=None)¶
- Retrieves the machine learning model architectures available on the platform. - Parameters
- fields (list[str], optional) – The fields to retrieve from the response. 
- Returns
- Machine learning model architectures 
- Return type
- dict 
 
- get_ml_inference_metrics(self, inferenceId, workspaceId=None)¶
- Get the metrics from an inference job. - Parameters
- inferenceId (str) – Inference ID 
- workspaceId (str) – Workspace ID 
 
- Returns
- Metric data 
- Return type
- dict 
 
- get_ml_inferences(self, workspaceId=None, inferenceId=None, datasetId=None, modelId=None, cursor=None, limit=None, filters=None, fields=None)¶
- Get the inferences of a machine learning model. - Parameters
- inferenceId (str) – Inference ID 
- datasetId (str) – Dataset ID 
- modelId (str) – Model ID 
- workspaceId (str) – Workspace ID 
- cursor (str) – Cursor for pagination 
- limit (int) – Maximum number of inferences to return 
- filters (dict) – Filters that limit output to entries that match the filter 
- fields (list) – List of fields to return, leave empty to get all fields. 
 
- Returns
- Inference data 
- Return type
- dict 
 
- get_ml_models(self, workspaceId=None, datasetId=None, modelId=None, cursor=None, limit=100, filters=None, fields=None)¶
- Retrieves the machine learning model architectures available on the platform. - Parameters
- workspaceId (str) – Workspace ID 
- datasetId (str) – Dataset ID 
- modelId (str) – Model ID 
- cursor (str, optional) – Cursor for pagination 
- limit (int, optional) – Maximum number of ml models to return 
- filters (dict) – Filters that limit output to entries that match the filter 
- fields (list[str], optional) – The fields to retrieve from the response. 
 
- Returns
- Machine learning model architectures 
- Return type
- dict 
 
- upload_ml_model(self, name, modelfile, architectureId, description=None, tags=None, workspaceId=None)¶
- Upload a machine learning model. - Parameters
- name (str) – Model name 
- modelfile (str) – The filepath of the compressed file containing the model, classes and spec. 
- architectureId (str) – Architecture ID 
- description (str) – Model description 
- tags (list[str]) – Model tags 
- workspaceId (str) – Workspace ID 
 
- Returns
- Success / failure 
- Return type
- bool 
 
