Reflection: Deep Learning with R-Ch4.5–4.6
ch4.5-ch4.6
### 4.5. THE UNIVERSAL WORKFLOW OF MACHINE LEARNING
#### 4.5.1. Defining the problem and assembling a dataset
#### 4.5.2. Choosing a measure of success
* balanced classification problems: accuracy and area under the receiver operating characteristic curve
* class imbalanced problems: precision and recall
* ranking problems or multilabel classification: mean average precision
#### 4.5.3. Deciding on an evaluation protocol
* Maintaining a holdout validation set: 有很多資料
* K-fold cross-validation: 只有一些資料
* iterated K-fold validation: 當只有一些資料,但需要高準度的模型
#### 4.5.4. Preparing your data
* 應轉為張量的格式
* scaled 至小範圍,如[-1, 1] or [0, 1]
* 變數間差異大的時候,normalized
* 做特徵工程,尤其當資料很少的時候
#### 4.5.5. Developing a model that does better than a baseline
* 選擇正確的 last-layer activation, loss function, optmization configuration
* optmization configuration: 通常選擇rmsprop就足夠了
#### 4.5.6. Scaling up: developing a model that overfits
* Remember that the universal tension in machine learning is between optimization and generalization; the ideal model is one that stands right at the border between underfitting and overfitting, between undercapacity and overcapacity.
* 找出合適的模型:
- 新增layer數
- 新增unit數
- 訓練更多epoch
* 監視訓練損失和驗證損失以及您關注的任何指標的訓練和驗證值。 當您發現模型在驗證數據上的性能開始下降時,就說明已經過擬合。
#### 4.5.7. Regularizing your model and tuning your hyperparameters
* Add dropout.
* 架構調整 Add or remove layers.
* Add L1 and/or L2 regularization.
* 超參數調整 (such as the number of units per layer or the learning rate of the optimizer)
* 新增減少變數
* 開發出令人滿意的模型配置後,可以在所有可用數據上訓練最終的生產模型(訓練和驗證),並最後一次在測試集上對其進行評估。若表現很差也可考慮更換評估方式 如 iterated k-fold.
### 4.6. SUMMARY
* 定義當前的問題以及要訓練的數據。 收集數據,或在需要時用標籤註釋。
* 選擇衡量問題成功與否的方式。 根據驗證數據監控哪些指標?
* 確定您的評估方式:保持驗證? Kfold驗證? 應使用數據的哪一部分進行驗證?
* 開發一個比基本baseline更好的模型:具有統計能力的模型。
* 建立一個過擬合的模型。
* 根據驗證數據的性能,對模型進行正則化並調整其超參數。 許多機器學習研究往往只專注於這一步,但要牢記全局。