Tune an Object2Vec Model
Automatic model tuning, also known as hyperparameter tuning, finds the best version of a model by running many jobs that test a range of hyperparameters on your dataset. You choose the tunable hyperparameters, a range of values for each, and an objective metric. For the objective metric, you use one of the metrics that the algorithm computes. Automatic model tuning searches the chosen hyperparameters to find the combination of values that result in the model that optimizes the objective metric.
For more information about model tuning, see Automatic model tuning with SageMaker AI.
Metrics Computed by the Object2Vec Algorithm
The Object2Vec algorithm has both classification and regression metrics. The
output_layer
type determines which metric you can use for automatic
model tuning.
Regressor Metrics Computed by the Object2Vec Algorithm
The algorithm reports a mean squared error regressor metric, which is computed during testing and validation. When tuning the model for regression tasks, choose this metric as the objective.
Metric Name | Description | Optimization Direction |
---|---|---|
test:mean_squared_error |
The Mean Square Error |
Minimize |
validation:mean_squared_error |
The Mean Square Error |
Minimize |
Classification Metrics Computed by the Object2Vec Algorithm
The Object2Vec algorithm reports accuracy and cross-entropy classification metrics, which are computed during test and validation. When tuning the model for classification tasks, choose one of these as the objective.
Metric Name | Description | Optimization Direction |
---|---|---|
test:accuracy |
Accuracy |
Maximize |
test:cross_entropy |
Cross-entropy |
Minimize |
validation:accuracy |
Accuracy |
Maximize |
validation:cross_entropy |
Cross-entropy |
Minimize |
Tunable Object2Vec Hyperparameters
You can tune the following hyperparameters for the Object2Vec algorithm.
Hyperparameter Name | Hyperparameter Type | Recommended Ranges and Values |
---|---|---|
dropout |
ContinuousParameterRange |
MinValue: 0.0, MaxValue: 1.0 |
early_stopping_patience |
IntegerParameterRange |
MinValue: 1, MaxValue: 5 |
early_stopping_tolerance |
ContinuousParameterRange |
MinValue: 0.001, MaxValue: 0.1 |
enc_dim |
IntegerParameterRange |
MinValue: 4, MaxValue: 4096 |
enc0_cnn_filter_width |
IntegerParameterRange |
MinValue: 1, MaxValue: 5 |
enc0_layers |
IntegerParameterRange |
MinValue: 1, MaxValue: 4 |
enc0_token_embedding_dim |
IntegerParameterRange |
MinValue: 5, MaxValue: 300 |
enc1_cnn_filter_width |
IntegerParameterRange |
MinValue: 1, MaxValue: 5 |
enc1_layers |
IntegerParameterRange |
MinValue: 1, MaxValue: 4 |
enc1_token_embedding_dim |
IntegerParameterRange |
MinValue: 5, MaxValue: 300 |
epochs |
IntegerParameterRange |
MinValue: 4, MaxValue: 20 |
learning_rate |
ContinuousParameterRange |
MinValue: 1e-6, MaxValue: 1.0 |
mini_batch_size |
IntegerParameterRange |
MinValue: 1, MaxValue: 8192 |
mlp_activation |
CategoricalParameterRanges |
[ |
mlp_dim |
IntegerParameterRange |
MinValue: 16, MaxValue: 1024 |
mlp_layers |
IntegerParameterRange |
MinValue: 1, MaxValue: 4 |
optimizer |
CategoricalParameterRanges | [ |
weight_decay |
ContinuousParameterRange |
MinValue: 0.0, MaxValue: 1.0 |