ml_models
Creates, updates, deletes, gets or lists a ml_models resource.
Overview
| Name | ml_models |
| Type | Resource |
| Id | aws.machinelearning.ml_models |
Fields
The following fields are returned by SELECT queries:
- get_ml_model
- describe_ml_models
| Name | Datatype | Description |
|---|---|---|
compute_time | integer (int64) | Long integer type that is a 64-bit signed number. |
created_at | string (date-time) | A timestamp represented in epoch time. |
created_by_iam_user | string | The AWS user account from which the MLModel was created. The account type can be either an AWS root account or an AWS Identity and Access Management (IAM) user account. (pattern: <code>arn:aws:iam::[0-9]+:((user/.+)|(root))</code>) |
endpoint_info | object | The current endpoint of the MLModel |
finished_at | string (date-time) | A timestamp represented in epoch time. |
input_data_location_s3 | string | The location of the data file or directory in Amazon Simple Storage Service (Amazon S3). (pattern: <code>s3://([^/]+)(/.*)?</code>) |
last_updated_at | string (date-time) | A timestamp represented in epoch time. |
log_uri | string | A link to the file that contains logs of the CreateMLModel operation. |
ml_model_id | string | The MLModel ID, which is same as the MLModelId in the request. (pattern: <code>[a-zA-Z0-9_.-]+</code>) |
ml_model_type | string | Identifies the MLModel category. The following are the available types: REGRESSION -- Produces a numeric result. For example, "What price should a house be listed at?" BINARY -- Produces one of two possible results. For example, "Is this an e-commerce website?" MULTICLASS -- Produces one of several possible results. For example, "Is this a HIGH, LOW or MEDIUM risk trade?" (REGRESSION, BINARY, MULTICLASS) |
message | string | A description of the most recent details about accessing the MLModel. |
name | string | A user-supplied name or description of the MLModel. |
recipe | string | The recipe to use when training the MLModel. The Recipe provides detailed information about the observation data to use during training, and manipulations to perform on the observation data during training. Note: This parameter is provided as part of the verbose format. |
schema | string | The schema used by all of the data files referenced by the DataSource. Note: This parameter is provided as part of the verbose format. |
score_threshold | number (float) | The scoring threshold is used in binary classification MLModel models. It marks the boundary between a positive prediction and a negative prediction. Output values greater than or equal to the threshold receive a positive result from the MLModel, such as true. Output values less than the threshold receive a negative response from the MLModel, such as false. |
score_threshold_last_updated_at | string (date-time) | A timestamp represented in epoch time. |
size_in_bytes | integer (int64) | Long integer type that is a 64-bit signed number. |
started_at | string (date-time) | A timestamp represented in epoch time. |
status | string | The current status of the MLModel. This element can have one of the following values: PENDING - Amazon Machine Learning (Amazon ML) submitted a request to describe a MLModel. INPROGRESS - The request is processing. FAILED - The request did not run to completion. The ML model isn't usable. COMPLETED - The request completed successfully. DELETED - The MLModel is marked as deleted. It isn't usable. (PENDING, INPROGRESS, FAILED, COMPLETED, DELETED) |
training_data_source_id | string | The ID of the training DataSource. (pattern: <code>[a-zA-Z0-9_.-]+</code>) |
training_parameters | object | A list of the training parameters in the MLModel. The list is implemented as a map of key-value pairs. The following is the current set of training parameters: sgd.maxMLModelSizeInBytes - The maximum allowed size of the model. Depending on the input data, the size of the model might affect its performance. The value is an integer that ranges from 100000 to 2147483648. The default value is 33554432. sgd.maxPasses - The number of times that the training process traverses the observations to build the MLModel. The value is an integer that ranges from 1 to 10000. The default value is 10. sgd.shuffleType - Whether Amazon ML shuffles the training data. Shuffling data improves a model's ability to find the optimal solution for a variety of data types. The valid values are auto and none. The default value is none. We strongly recommend that you shuffle your data. sgd.l1RegularizationAmount - The coefficient regularization L1 norm. It controls overfitting the data by penalizing large coefficients. This tends to drive coefficients to zero, resulting in a sparse feature set. If you use this parameter, start by specifying a small value, such as 1.0E-08. The value is a double that ranges from 0 to MAX_DOUBLE. The default is to not use L1 normalization. This parameter can't be used when L2 is specified. Use this parameter sparingly. sgd.l2RegularizationAmount - The coefficient regularization L2 norm. It controls overfitting the data by penalizing large coefficients. This tends to drive coefficients to small, nonzero values. If you use this parameter, start by specifying a small value, such as 1.0E-08. The value is a double that ranges from 0 to MAX_DOUBLE. The default is to not use L2 normalization. This parameter can't be used when L1 is specified. Use this parameter sparingly. |
| Name | Datatype | Description |
|---|---|---|
algorithm | string | The algorithm used to train the MLModel. The following algorithm is supported: SGD -- Stochastic gradient descent. The goal of SGD is to minimize the gradient of the loss function. (sgd) |
compute_time | integer (int64) | Long integer type that is a 64-bit signed number. |
created_at | string (date-time) | A timestamp represented in epoch time. |
created_by_iam_user | string | The AWS user account from which the MLModel was created. The account type can be either an AWS root account or an AWS Identity and Access Management (IAM) user account. (pattern: <code>arn:aws:iam::[0-9]+:((user/.+)|(root))</code>) |
endpoint_info | object | The current endpoint of the MLModel. |
finished_at | string (date-time) | A timestamp represented in epoch time. |
input_data_location_s3 | string | The location of the data file or directory in Amazon Simple Storage Service (Amazon S3). (pattern: <code>s3://([^/]+)(/.*)?</code>) |
last_updated_at | string (date-time) | A timestamp represented in epoch time. |
ml_model_id | string | The ID assigned to the MLModel at creation. (pattern: <code>[a-zA-Z0-9_.-]+</code>) |
ml_model_type | string | Identifies the MLModel category. The following are the available types: REGRESSION - Produces a numeric result. For example, "What price should a house be listed at?" BINARY - Produces one of two possible results. For example, "Is this a child-friendly web site?". MULTICLASS - Produces one of several possible results. For example, "Is this a HIGH-, LOW-, or MEDIUM-risk trade?". (REGRESSION, BINARY, MULTICLASS) |
message | string | A description of the most recent details about accessing the MLModel. |
name | string | A user-supplied name or description of the MLModel. |
score_threshold | number (float) | |
score_threshold_last_updated_at | string (date-time) | A timestamp represented in epoch time. |
size_in_bytes | integer (int64) | Long integer type that is a 64-bit signed number. |
started_at | string (date-time) | A timestamp represented in epoch time. |
status | string | The current status of an MLModel. This element can have one of the following values: PENDING - Amazon Machine Learning (Amazon ML) submitted a request to create an MLModel. INPROGRESS - The creation process is underway. FAILED - The request to create an MLModel didn't run to completion. The model isn't usable. COMPLETED - The creation process completed successfully. DELETED - The MLModel is marked as deleted. It isn't usable. (PENDING, INPROGRESS, FAILED, COMPLETED, DELETED) |
training_data_source_id | string | The ID of the training DataSource. The CreateMLModel operation uses the TrainingDataSourceId. (pattern: <code>[a-zA-Z0-9_.-]+</code>) |
training_parameters | object | A list of the training parameters in the MLModel. The list is implemented as a map of key-value pairs. The following is the current set of training parameters: sgd.maxMLModelSizeInBytes - The maximum allowed size of the model. Depending on the input data, the size of the model might affect its performance. The value is an integer that ranges from 100000 to 2147483648. The default value is 33554432. sgd.maxPasses - The number of times that the training process traverses the observations to build the MLModel. The value is an integer that ranges from 1 to 10000. The default value is 10. sgd.shuffleType - Whether Amazon ML shuffles the training data. Shuffling the data improves a model's ability to find the optimal solution for a variety of data types. The valid values are auto and none. The default value is none. sgd.l1RegularizationAmount - The coefficient regularization L1 norm, which controls overfitting the data by penalizing large coefficients. This parameter tends to drive coefficients to zero, resulting in sparse feature set. If you use this parameter, start by specifying a small value, such as 1.0E-08. The value is a double that ranges from 0 to MAX_DOUBLE. The default is to not use L1 normalization. This parameter can't be used when L2 is specified. Use this parameter sparingly. sgd.l2RegularizationAmount - The coefficient regularization L2 norm, which controls overfitting the data by penalizing large coefficients. This tends to drive coefficients to small, nonzero values. If you use this parameter, start by specifying a small value, such as 1.0E-08. The value is a double that ranges from 0 to MAX_DOUBLE. The default is to not use L2 normalization. This parameter can't be used when L1 is specified. Use this parameter sparingly. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_ml_model | select | region | Returns an MLModel that includes detailed metadata, data source information, and the current status of the MLModel. GetMLModel provides results in normal or verbose format. | |
describe_ml_models | select | region | Returns a list of MLModel that match the search criteria in the request. | |
create_ml_model | insert | region, MLModelId, MLModelType, TrainingDataSourceId | Creates a new MLModel using the DataSource and the recipe as information sources. An MLModel is nearly immutable. Users can update only the MLModelName and the ScoreThreshold in an MLModel without creating a new MLModel. CreateMLModel is an asynchronous operation. In response to CreateMLModel, Amazon Machine Learning (Amazon ML) immediately returns and sets the MLModel status to PENDING. After the MLModel has been created and ready is for use, Amazon ML sets the status to COMPLETED. You can use the GetMLModel operation to check the progress of the MLModel during the creation operation. CreateMLModel requires a DataSource with computed statistics, which can be created by setting ComputeStatistics to true in CreateDataSourceFromRDS, CreateDataSourceFromS3, or CreateDataSourceFromRedshift operations. | |
create_realtime_endpoint | insert | region, MLModelId | Creates a real-time endpoint for the MLModel. The endpoint contains the URI of the MLModel; that is, the location to send real-time prediction requests for the specified MLModel. | |
update_ml_model | update | region, MLModelId | Updates the MLModelName and the ScoreThreshold of an MLModel. You can use the GetMLModel operation to view the contents of the updated data element. | |
delete_ml_model | delete | region | Assigns the DELETED status to an MLModel, rendering it unusable. After using the DeleteMLModel operation, you can use the GetMLModel operation to verify that the status of the MLModel changed to DELETED. Caution: The result of the DeleteMLModel operation is irreversible. | |
delete_realtime_endpoint | exec | region, MLModelId | Deletes a real time endpoint of an MLModel. | |
predict | exec | region, MLModelId, Record, PredictEndpoint | Generates a prediction for the observation using the specified ML Model. Note: Not all response parameters will be populated. Whether a response parameter is populated depends on the type of model requested. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_ml_model
- describe_ml_models
Returns an MLModel that includes detailed metadata, data source information, and the current status of the MLModel. GetMLModel provides results in normal or verbose format.
SELECT
compute_time,
created_at,
created_by_iam_user,
endpoint_info,
finished_at,
input_data_location_s3,
last_updated_at,
log_uri,
ml_model_id,
ml_model_type,
message,
name,
recipe,
schema,
score_threshold,
score_threshold_last_updated_at,
size_in_bytes,
started_at,
status,
training_data_source_id,
training_parameters
FROM aws.machinelearning.ml_models
WHERE region = '{{ region }}' -- required
;
Returns a list of MLModel that match the search criteria in the request.
SELECT
algorithm,
compute_time,
created_at,
created_by_iam_user,
endpoint_info,
finished_at,
input_data_location_s3,
last_updated_at,
ml_model_id,
ml_model_type,
message,
name,
score_threshold,
score_threshold_last_updated_at,
size_in_bytes,
started_at,
status,
training_data_source_id,
training_parameters
FROM aws.machinelearning.ml_models
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_ml_model
- create_realtime_endpoint
- Manifest
Creates a new MLModel using the DataSource and the recipe as information sources. An MLModel is nearly immutable. Users can update only the MLModelName and the ScoreThreshold in an MLModel without creating a new MLModel. CreateMLModel is an asynchronous operation. In response to CreateMLModel, Amazon Machine Learning (Amazon ML) immediately returns and sets the MLModel status to PENDING. After the MLModel has been created and ready is for use, Amazon ML sets the status to COMPLETED. You can use the GetMLModel operation to check the progress of the MLModel during the creation operation. CreateMLModel requires a DataSource with computed statistics, which can be created by setting ComputeStatistics to true in CreateDataSourceFromRDS, CreateDataSourceFromS3, or CreateDataSourceFromRedshift operations.
INSERT INTO aws.machinelearning.ml_models (
MLModelId,
MLModelName,
MLModelType,
Parameters,
TrainingDataSourceId,
Recipe,
RecipeUri,
region
)
SELECT
'{{ MLModelId }}' /* required */,
'{{ MLModelName }}',
'{{ MLModelType }}' /* required */,
'{{ Parameters }}',
'{{ TrainingDataSourceId }}' /* required */,
'{{ Recipe }}',
'{{ RecipeUri }}',
'{{ region }}'
RETURNING
ml_model_id
;
Creates a real-time endpoint for the MLModel. The endpoint contains the URI of the MLModel; that is, the location to send real-time prediction requests for the specified MLModel.
INSERT INTO aws.machinelearning.ml_models (
MLModelId,
region
)
SELECT
'{{ MLModelId }}' /* required */,
'{{ region }}'
RETURNING
ml_model_id,
realtime_endpoint_info
;
# Description fields are for documentation purposes
- name: ml_models
props:
- name: region
value: "{{ region }}"
description: Required parameter for the ml_models resource.
- name: MLModelId
value: "{{ MLModelId }}"
description: |
The ID assigned to the MLModel during creation.
- name: MLModelName
value: "{{ MLModelName }}"
description: |
A user-supplied name or description of the MLModel.
- name: MLModelType
value: "{{ MLModelType }}"
description: |
The category of supervised learning that this MLModel will address. Choose from the following types: Choose REGRESSION if the MLModel will be used to predict a numeric value. Choose BINARY if the MLModel result has two possible values. Choose MULTICLASS if the MLModel result has a limited number of values. For more information, see the Amazon Machine Learning Developer Guide.
valid_values: ['REGRESSION', 'BINARY', 'MULTICLASS']
- name: Parameters
value: "{{ Parameters }}"
description: |
A list of the training parameters in the MLModel. The list is implemented as a map of key-value pairs. The following is the current set of training parameters: sgd.maxMLModelSizeInBytes - The maximum allowed size of the model. Depending on the input data, the size of the model might affect its performance. The value is an integer that ranges from 100000 to 2147483648. The default value is 33554432. sgd.maxPasses - The number of times that the training process traverses the observations to build the MLModel. The value is an integer that ranges from 1 to 10000. The default value is 10. sgd.shuffleType - Whether Amazon ML shuffles the training data. Shuffling the data improves a model's ability to find the optimal solution for a variety of data types. The valid values are auto and none. The default value is none. We strongly recommend that you shuffle your data. sgd.l1RegularizationAmount - The coefficient regularization L1 norm. It controls overfitting the data by penalizing large coefficients. This tends to drive coefficients to zero, resulting in a sparse feature set. If you use this parameter, start by specifying a small value, such as 1.0E-08. The value is a double that ranges from 0 to MAX_DOUBLE. The default is to not use L1 normalization. This parameter can't be used when L2 is specified. Use this parameter sparingly. sgd.l2RegularizationAmount - The coefficient regularization L2 norm. It controls overfitting the data by penalizing large coefficients. This tends to drive coefficients to small, nonzero values. If you use this parameter, start by specifying a small value, such as 1.0E-08. The value is a double that ranges from 0 to MAX_DOUBLE. The default is to not use L2 normalization. This parameter can't be used when L1 is specified. Use this parameter sparingly.
- name: TrainingDataSourceId
value: "{{ TrainingDataSourceId }}"
description: |
The DataSource that points to the training data.
- name: Recipe
value: "{{ Recipe }}"
description: |
The data recipe for creating the MLModel. You must specify either the recipe or its URI. If you don't specify a recipe or its URI, Amazon ML creates a default.
- name: RecipeUri
value: "{{ RecipeUri }}"
description: |
The Amazon Simple Storage Service (Amazon S3) location and file name that contains the MLModel recipe. You must specify either the recipe or its URI. If you don't specify a recipe or its URI, Amazon ML creates a default.
UPDATE examples
- update_ml_model
Updates the MLModelName and the ScoreThreshold of an MLModel. You can use the GetMLModel operation to view the contents of the updated data element.
UPDATE aws.machinelearning.ml_models
SET
MLModelId = '{{ MLModelId }}',
MLModelName = '{{ MLModelName }}',
ScoreThreshold = {{ ScoreThreshold }}
WHERE
region = '{{ region }}' --required
AND MLModelId = '{{ MLModelId }}' --required
RETURNING
ml_model_id;
DELETE examples
- delete_ml_model
Assigns the DELETED status to an MLModel, rendering it unusable. After using the DeleteMLModel operation, you can use the GetMLModel operation to verify that the status of the MLModel changed to DELETED. Caution: The result of the DeleteMLModel operation is irreversible.
DELETE FROM aws.machinelearning.ml_models
WHERE region = '{{ region }}' --required
;
Lifecycle Methods
- delete_realtime_endpoint
- predict
Deletes a real time endpoint of an MLModel.
EXEC aws.machinelearning.ml_models.delete_realtime_endpoint
@region='{{ region }}' --required
@@json=
'{
"MLModelId": "{{ MLModelId }}"
}'
;
Generates a prediction for the observation using the specified ML Model. Note: Not all response parameters will be populated. Whether a response parameter is populated depends on the type of model requested.
EXEC aws.machinelearning.ml_models.predict
@region='{{ region }}' --required
@@json=
'{
"MLModelId": "{{ MLModelId }}",
"Record": "{{ Record }}",
"PredictEndpoint": "{{ PredictEndpoint }}"
}'
;