Tune a BlazingText 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 BlazingText Algorithm
The BlazingText Word2Vec algorithm (skipgram
, cbow
, and
batch_skipgram
modes) reports on a single metric during training:
train:mean_rho
. This metric is computed on WS-353 word similarity datasets
The BlazingText Text Classification algorithm (supervised
mode), also
reports on a single metric during training: the validation:accuracy
.
When tuning the hyperparameter values for the text classification algorithm, use
these metrics as the objective.
Metric Name | Description | Optimization Direction |
---|---|---|
train:mean_rho |
The mean rho (Spearman's rank correlation coefficient) on
WS-353 word similarity datasets |
Maximize |
validation:accuracy |
The classification accuracy on the user-specified validation dataset |
Maximize |
Tunable BlazingText Hyperparameters
Tunable Hyperparameters for the Word2Vec Algorithm
Tune an Amazon SageMaker BlazingText Word2Vec model with the following
hyperparameters. The hyperparameters that have the greatest impact on Word2Vec
objective metrics are: mode
, learning_rate
,
window_size
, vector_dim
, and
negative_samples
.
Parameter Name | Parameter Type | Recommended Ranges or Values |
---|---|---|
batch_size |
|
[8-32] |
epochs |
|
[5-15] |
learning_rate |
|
MinValue: 0.005, MaxValue: 0.01 |
min_count |
|
[0-100] |
mode |
|
[ |
negative_samples |
|
[5-25] |
sampling_threshold |
|
MinValue: 0.0001, MaxValue: 0.001 |
vector_dim |
|
[32-300] |
window_size |
|
[1-10] |
Tunable Hyperparameters for the Text Classification Algorithm
Tune an Amazon SageMaker BlazingText text classification model with the following hyperparameters.
Parameter Name | Parameter Type | Recommended Ranges or Values |
---|---|---|
buckets |
|
[1000000-10000000] |
epochs |
|
[5-15] |
learning_rate |
|
MinValue: 0.005, MaxValue: 0.01 |
min_count |
|
[0-100] |
vector_dim |
|
[32-300] |
word_ngrams |
|
[1-3] |