Tune a Text Classification - TensorFlow 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. You choose the objective metric from the metrics that the algorithm computes. Automatic model tuning searches the hyperparameters chosen 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.
Metrics computed by the Text Classification - TensorFlow algorithm
Refer to the following chart to find which metrics are computed by the Text Classification - TensorFlow algorithm.
Metric Name | Description | Optimization Direction | Regex Pattern |
---|---|---|---|
validation:accuracy |
The ratio of the number of correct predictions to the total number of predictions made. |
Maximize |
|
Tunable Text Classification - TensorFlow hyperparameters
Tune a text classification model with the following hyperparameters. The
hyperparameters that have the greatest impact on text classification objective
metrics are: batch_size
, learning_rate
, and
optimizer
. Tune the optimizer-related hyperparameters, such as
momentum
, regularizers_l2
, beta_1
,
beta_2
, and eps
based on the selected
optimizer
. For example, use beta_1
and
beta_2
only when adamw
or adam
is the
optimizer
.
For more information about which hyperparameters are used for each optimizer
, see
Text Classification - TensorFlow
Hyperparameters.
Parameter Name | Parameter Type | Recommended Ranges |
---|---|---|
batch_size |
IntegerParameterRanges |
MinValue: 4, MaxValue: 128 |
beta_1 |
ContinuousParameterRanges |
MinValue: 1e-6, MaxValue: 0.999 |
beta_2 |
ContinuousParameterRanges |
MinValue: 1e-6, MaxValue: 0.999 |
eps |
ContinuousParameterRanges |
MinValue: 1e-8, MaxValue: 1.0 |
learning_rate |
ContinuousParameterRanges |
MinValue: 1e-6, MaxValue: 0.5 |
momentum |
ContinuousParameterRanges |
MinValue: 0.0, MaxValue: 0.999 |
optimizer |
CategoricalParameterRanges |
['adamw', 'adam', 'sgd', 'rmsprop', 'nesterov', 'adagrad', 'adadelta'] |
regularizers_l2 |
ContinuousParameterRanges |
MinValue: 0.0, MaxValue: 0.999 |
train_only_on_top_layer |
CategoricalParameterRanges |
['True', 'False'] |