吴恩达深度学习笔记8-Course3-Week1【机器学习策略(ML Strategy)1】
結構化機器學習項目
機器學習策略(ML Strategy)1
一、機器學習策略介紹(Introduction to ML Strategy)
1、機器學習策略
就是超參數調優的策略,怎么調?怎們評估調優的效果?調哪些超參的效果更好?超參數調優的次序?
下圖是一些經常調優的超參:
2、正交化(Orthogonalization)
正交化或正交性是一種系統設計屬性,可確保修改算法的某一部分不會對系統的其他部分產生或傳播副作用。 它使得相互獨立驗證算法變得更加容易,且減少了測試和開發時間。
(Orthogonalization or orthogonality is a system design property that assures that modifying an instruction or a component of an algorithm will not create or propagate side effects to other components of the system. It becomes easier to verify the algorithms independently from one another, it reduces testing and development time.)
其實就是類似于我們做實驗時的控制變量法,一次只調優一個超參,保持其它超參不變,超參相互獨立。
當設計一個監督型的學習模型時,下面的4個假設需要成立且相互正交。
(When a supervised learning system is design, these are the 4 assumptions that needs to be true and orthogonal.)
(1) Fit training set well in cost function
If it doesn’t fit well, the use of a bigger neural network or switching to a better optimization algorithm might help.
(2)Fit development set well on cost function
If it doesn’t fit well, regularization or using bigger training set might help.
(3)Fit test set well on cost function
If it doesn’t fit well, the use of a bigger development set might help
(4)Performs well in real world
If it doesn’t perform well, the development test set is not set correctly or the cost function is not evaluating the right thing.
二、設置優化目標(Setting up your goal)
1、單一數字評估指標(Single number evaluation metric)
查準率 (Precision);查全率 (Recall);F1-Score:查準率與查全率的 trade off;
注: Recall 的分母應該是 True positive + False negative
p: recision; r :recall
如果同時關注 precision 和 recall 兩個指標,很難對算法效果做出判斷。所以通常以F1-Score作為評估算法效果的單一指標。F1-Score 越大效果越好。
有時候也會把平均數作為單一數字評估指標:
下表的百分比表示誤差,所以平均誤差越小越好
2、設置滿足和優化目標(Satisficing and Optimizing metrics)
滿足目標:只要達到要求就行,不一定得很好
優化目標:盡可能的達到最好,不斷優化。
分類器的性能有許多不同的評估指標,稱為評估矩陣。它們可以歸類為滿足矩陣和優化矩陣。要注意,這些評估指標必須在訓練集、開發集或測試集上進行評估。
(There are different metrics to evaluate the performance of a classifier, they are called evaluation matrices. They can be categorized as satisficing and optimizing matrices. It is important to note that these evaluation matrices must be evaluated on a training set, a development set or on the test set.)
一般的(general),如果要有N個指標,通常選擇其中一個指標為優化指標,其它的N-1個指標為滿足指標:
以算法的運行時間(Running time)和準確率(Accuracy)為例,通常運行時間只需要滿足一定要求即可,如<100ms; 而準確率越高越好;所以把運行時間設為滿足目標,準確率設為優化目標。
三、設置訓練、開發、測試集(Setting up training、development and test sets)
1、開發、測試集中的數據選擇建議
- 開發集和測試集要來自同一分布 (same distribution )且隨機選擇樣本 (randomly select)
例:數據來自不同區域,開發集和測試集的數據選擇不能使兩個數據集分別從不同的某幾個地區選取。正確的做法是在所有的地區中隨機選擇樣本來分配給開發集和測試集。
- 開發集和測試集中的數據最好能反應未來的數據(Choose a development set and test set to reflect data you expect to get in the future and consider important to do well)
2、訓練、開發、測試集中的數據量(size)
訓練集: 越大越好
開發集: 不用太大,夠用就行,主要用來評估不同模型的效果,能區分不同模型的的差別即可。
測試集:視應用目標而定,越大置信度越高,一般不用太大。
三、修改評估指標或開發、測試集
1、開發模型也可以看做是Orthogonalization
首先,設置優化目標(評估指標),類比于靶心。
然后,不斷的優化向優化目標逼近,類比瞄準靶心發射。
2、修改評估指標
當我們的算法中不允許包含某一向錯誤時,我們就要修改評價指標(錯誤率),給這項錯誤設置一個很大的權重,這樣算法為了減小錯誤率會優先減小這項錯誤的產生。
3、修改開發、測試集
如果在訓練開發測試的過程中得到的模型效果比較好,但是在實際應用中效果卻不好的時候,就需要改變開發、測試集或者評估指標。例:當開發、測試集是高質量的圖片而應用中用戶的是低質量的圖片時法,算法效果比較差。這時候應該把改變開發、測試集應為隨機選擇高低質量的圖片。
四、人類表現比較(Comparing to human-level performance)
1.人類水平和貝葉斯最優誤差
人類水平(Human level):對于某項任務,人類能達到的準確率。人類誤差不是固定值,因為普通人和專家是有區別的,人為水平的定義取決于分析的目的和應用場景而定。
貝葉斯最優誤差(Bayes optimal error):對于某項任務,理論上能達到的準確率,一定優于人類水平。
通常在語音識別、計算機視覺中可以把貝葉斯最優誤差約等于人類誤差,因為人類很擅長這方面的處理。
可避免的偏差(Avoidable bias)和方差variance:
可避免的偏差:人類水平或貝葉斯與訓練集誤差的差
方差:開發集與訓練集誤差的差。
哪個大優先優化即減小哪個,因為可提升的空間較大。
超過人的表現(Surpassing human-level performance)
以下是目前機器學習超過人類水平的幾個方面,它們基本上是結構化數據的學習,因為計算機擅長于與數值計算與統計,而且數據量大,所以表現比人好。但在非結構化數據的學習方面,目前在這方面的學習超過人類水平的應用并不多,大部分還無法超過人類。
改善模型的表現(Improving your model performance)
Two fundamental assumptions of supervised learning:
- The first one is to have a low avoidable bias which means that the training set fits well.
- The second one is to have a low or acceptable variance which means that the training set performance generalizes well to the development set and test set.
不滿足這兩個假設的改進方法:
總結
以上是生活随笔為你收集整理的吴恩达深度学习笔记8-Course3-Week1【机器学习策略(ML Strategy)1】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 计算机系统结构结构相关实验报告,计算机系
- 下一篇: java 阅发布模式_redis发布订阅