

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 調校 BlazingText 模型
<a name="blazingtext-tuning"></a>

*自動模型調校*，又稱為超參數調校，會透過在您的資料集上，執行許多測試超參數範圍的任務，來尋找最佳版本的模型。您可以選擇可調校的超參數、每一個超參數的值範圍，及目標指標。您可以從演算法運算的指標中選擇目標指標。自動模型調校會搜尋所選擇的超參數，以找出產生之模型可最佳化目標指標的值組合。

如需模型調校的詳細資訊，請參閱[使用 SageMaker AI 執行自動模型調校](automatic-model-tuning.md)。

## BlazingText 演算法運算的指標
<a name="blazingtext-metrics"></a>

BlazingText Word2Vec 演算法 (`skipgram`、`cbow` 和 `batch_skipgram` 模式) 會在訓練期間報告單一指標：`train:mean_rho`。此指標是根據 [WS-353 word similarity datasets](https://aclweb.org/aclwiki/WordSimilarity-353_Test_Collection_(State_of_the_art)) 運算。針對 Word2Vec 演算法調校超參數值時，請使用此指標做為目標。

BlazingText 文字分類演算法 (`supervised` 模式)，也會在訓練期間報告單一指標：`validation:accuracy`。針對文字分類演算法調校超參數值時，請使用這些指標做為目標。


| 指標名稱 | Description | 最佳化方向 | 
| --- | --- | --- | 
| train:mean\$1rho |  [WS-353 word similarity datasets](http://alfonseca.org/pubs/ws353simrel.tar.gz) 上的平均 rho (Spearman 的排名關聯係數)  |  最大化  | 
| validation:accuracy |  使用者指定驗證資料集上的分類準確度  |  最大化  | 

## 可調校 BlazingText 超參數
<a name="blazingtext-tunable-hyperparameters"></a>

### Word2Vec 演算法可調校的超參數
<a name="blazingtext-tunable-hyperparameters-word2vec"></a>

使用下列超參數調校 Amazon SageMaker AI BlazingText Word2Vec 模型。對 Word2Vec 目標指標影響最大的超參數為：`mode`、` learning_rate`、`window_size`、`vector_dim` 及 `negative_samples`。


| 參數名稱 | 參數類型 | 建議的範圍或值 | 
| --- | --- | --- | 
| batch\$1size |  `IntegerParameterRange`  |  [8-32]  | 
| epochs |  `IntegerParameterRange`  |  [5-15]  | 
| learning\$1rate |  `ContinuousParameterRange`  |  MinValue：0.005、MaxValue：0.01  | 
| min\$1count |  `IntegerParameterRange`  |  [0-100]  | 
| mode |  `CategoricalParameterRange`  |  [`'batch_skipgram'`, `'skipgram'`, `'cbow'`]  | 
| negative\$1samples |  `IntegerParameterRange`  |  [5-25]  | 
| sampling\$1threshold |  `ContinuousParameterRange`  |  MinValue: 0.0001、MaxValue: 0.001  | 
| vector\$1dim |  `IntegerParameterRange`  |  [32-300]  | 
| window\$1size |  `IntegerParameterRange`  |  [1-10]  | 

### 文字分類演算法可調校的超參數
<a name="blazingtext-tunable-hyperparameters-text_class"></a>

使用下列超參數來調校 Amazon SageMaker AI BlazingText 文字分類模型。


| 參數名稱 | 參數類型 | 建議的範圍或值 | 
| --- | --- | --- | 
| buckets |  `IntegerParameterRange`  |  [1000000-10000000]  | 
| epochs |  `IntegerParameterRange`  |  [5-15]  | 
| learning\$1rate |  `ContinuousParameterRange`  |  MinValue：0.005、MaxValue：0.01  | 
| min\$1count |  `IntegerParameterRange`  |  [0-100]  | 
| vector\$1dim |  `IntegerParameterRange`  |  [32-300]  | 
| word\$1ngrams |  `IntegerParameterRange`  |  [1-3]  | 