Documentation for Model
and related classes
Deployment
The object model represents a deployment request in the Engine
delete()
Delete the deployment
predict(data_source, explain=False)
Run online prediction
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_source |
DataSource
|
input data to run the prediction |
required |
explain |
bool
|
set to True of the prediction explanation is expected. Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
any
|
Prediction result and explanations if explain = True |
Evaluation
The object model represents a model evaluation request and result in the Engine
EvaluationResult
dataclass
Result of model evaluation
details: dict
class-attribute
Evaluation result details
summary: dict
class-attribute
Evaluation summary
Model
The object model represents a project in the Engine
delete()
Delete the model.
Warning
This action cannot be undone. All trained model data will be deleted.
deploy(name=None, description=None, endpoint_name=None, endpoint_id=None, endpoint_description=None, training_id=None, type='cloud', auto_activate=True, auto_deploy=False, timeout=DEFAULT_TIMEOUT)
Deploy the model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
name of the deployment. Defaults to None. |
None
|
description |
str
|
description of the deployment. Defaults to None. |
None
|
endpoint_name |
str
|
name of the endpoint. Defaults to None. |
None
|
endpoint_id |
str
|
ID of the endpoint. Defaults to None. |
None
|
endpoint_description |
str
|
description of the endpoint. Defaults to None. |
None
|
training_id |
str
|
ID of the training. Defaults to None. |
None
|
type |
str
|
description. Defaults to 'cloud'. |
'cloud'
|
auto_activate |
bool
|
description. Defaults to True. |
True
|
auto_deploy |
bool
|
description. Defaults to False. |
False
|
timeout |
_type_
|
description. Defaults to DEFAULT_TIMEOUT. |
DEFAULT_TIMEOUT
|
Returns:
Name | Type | Description |
---|---|---|
Deployment |
Deployment
|
the object represents the deployment |
enable_continuous_learning(enabled)
Enable/disable continuous learning for the model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
enabled |
bool
|
enabled if True |
required |
evaluate(train_dataset_version=LATEST_VERSION, test_dataset_id=None, test_dataset_version=LATEST_VERSION, timeout=DEFAULT_TIMEOUT)
Evaluate the model with a test dataset
Parameters:
Name | Type | Description | Default |
---|---|---|---|
train_dataset_version |
int
|
the dataset version on which the model is trained. Defaults to LATEST_VERSION. |
LATEST_VERSION
|
test_dataset_version |
int
|
the version of test dataset. Defaults to LATEST_VERSION. |
LATEST_VERSION
|
timeout |
int
|
time to wait for the evaluation processed. Defaults to DEFAULT_TIMEOUT. |
DEFAULT_TIMEOUT
|
Raises:
Type | Description |
---|---|
RuntimeError
|
if the model has not been evaluated on the provided version of test dataset |
Returns:
Type | Description |
---|---|
Evaluation
|
the Evaluation object |
generate_insights(dataset_version=LATEST_VERSION, timeout=DEFAULT_TIMEOUT)
Generate model insights
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset_version |
int
|
the dataset version on which the model trained. Defaults to LATEST_VERSION. |
LATEST_VERSION
|
timeout |
int
|
time (in seconds) to wait for the model insights generated. Defaults to DEFAULT_TIMEOUT. |
DEFAULT_TIMEOUT
|
Raises:
Type | Description |
---|---|
RuntimeError
|
raised if the pipeline was failed |
Return
List of all generated artifacts
get_insight(type, dataset_version=LATEST_VERSION)
Get insights
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type |
ModelInsightsType
|
description |
required |
dataset_version |
int
|
description. Defaults to LATEST_VERSION. |
LATEST_VERSION
|
Returns:
Name | Type | Description |
---|---|---|
ModelInsights |
ModelInsight
|
description |
get_training(dataset_version=LATEST_VERSION)
Get the training on dataset version
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset_version |
int
|
version of the training dataset. Defaults to LATEST_VERSION. |
LATEST_VERSION
|
name()
property
Name of the model
Returns:
Type | Description |
---|---|
str
|
Name of the model |
run_batch_prediction(data_source, train_dataset_version=LATEST_VERSION, timeout=DEFAULT_TIMEOUT, pipeline_configuration_id='')
Run a batch prediction
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_source |
DataSource
|
source of the input data |
required |
train_dataset_version |
int
|
Version of the train dataset on which the model trained. Defaults to LATEST_VERSION. |
LATEST_VERSION
|
timeout |
int
|
Wait maximum |
DEFAULT_TIMEOUT
|
pipeline_configuration_id |
str
|
configuration used to run the prediction |
''
|
Raises:
Type | Description |
---|---|
RuntimeError
|
description |
Returns:
Name | Type | Description |
---|---|---|
Prediction |
Prediction
|
Prediction resource |
update(name)
Update model information
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
updated model name |
required |
description |
str
|
updated model description. Defaults to None. |
required |
wait_for_trained(dataset_version=LATEST_VERSION, timeout=DEFAULT_TIMEOUT * 2)
Wait until the model trained
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset_version |
int
|
the version of dataset on which the model was trained. Defaults to LATEST_VERSION. |
LATEST_VERSION
|
timeout |
int
|
time to wait for the model trained. Defaults to DEFAULT_TIMEOUT*2. |
DEFAULT_TIMEOUT * 2
|
Prediction
The object model represents a prediction request in the Engine
export(dataset_name, project_id=None, timeout=DEFAULT_TIMEOUT)
Export prediction result dataset to the project.
dataset_name (str): name of the copied dataset project_id (str): ID of the project to which the dataset will be copied. Defaults to None (same project as current dataset)