• 沒有找到結果。

第四章 實驗

4.2 實驗步驟

4.2.2 實驗方法

本實驗的機器設備與環境如下表:

表 5: 實驗機器設備與環境

CPU Intel(R) Core(TM) i7 CPU 3770 3.4GHz 3.4GHz

RAM 16GB Language Matlab

本實驗在資料集資料量為兩萬筆以下的實驗,是採用 5-fold 的實驗方法,其步 驟為先統一先隨機地打亂資料集的排列順序, 再把資料集分成 5 等分和五個 fold,

每一個 fold 皆分成 80%之 Training Data 和 20%的 Testing Data,其意義在於使每一 個等分都能有成為 Testing Data 的機會,以避免一次實驗中 20%的 Testing Data 皆 為原本就是好分地那些 Data Point。

在資料集 RCV1 的實驗上,是採用如 4.2.1 所述之 training data 和 testing data。

而在資料量達兩百萬筆的 Wikipedia 資料集,是採用隨機將資料分成 80%之 Training Data 和 20%的 Testing Data 之作法。

我們用來與本論文提出的方法 Online CRP 的比較方法有 Online Perceptron、

Online Logical Regression 、Online SVM、Logical Regression、SVM、Naive Bayes。

4.3 效能評估方式

4.3.1 F1 cluster evaluation

雖然此實驗是分類之實驗,但由於本論文所提出之方法 Online CRP,於預測 時容許預測都不是我們訓練資料裡面擁有的類別,因此若使用 F1 class

evaluation,會有計算定義混淆之問題。因此本論文一律採用 F1 cluster

evaluation 來做效能測量指標。以下為 F1 cluster evaluation 四種比較的方法:

1. True Positives(TP):

系統將兩篇文章分在同一群,而這兩篇文章實際上也是在同一個類別裡。

2. False Positives(FP):

系統將兩篇文章分在同一群,但這兩篇文章實際上不是在同一個類別裡。

3. True Negatives(TN):

系統將兩篇文章分在不同群,而這兩篇文章實際上也不在同一個類別裡。

4. False Negatives(FN):

系統將兩篇文章分在不同群,而這兩篇文章實際上卻是在同一個類別裡。

而 F1 cluster evaluation measure 之定義如下

Pr c s on = TP TP + P

r call = TP TP +

1 = ∗ pr c s on ∗ r call pr c s on + r call

4.3.2 Error rate

錯誤率即為計算預測的類別和實際的類別不相等的次數再除以總預測次數。

4.3.3 Execution time

此部分為測量整個程式從模型開始訓練到預測完所有測試資料的時間。本實驗 以秒數為計量單位。

4.4 實驗結果

1.與其他 Online Learning Algorithm 之比較

於 20newsgroup 兩萬篇文章的實驗中,可以從表 6 明顯看出,本論文提出之 方法之效能贏過其他方法,且執行時間也比其他方法快很多。其中 Online SVM 更

Error Rate Cluster F1 Value Execution time(s) Online CRP 0.200980+-0.010022 0.679006+-0.022357 312.818196+-8.920450 Online Last Perceptron 0.516627+-0.039270 0.213904+-0.032936 1075.408193+-103.908960

Vote Perceptron 0.443566+-0.013335 0.252989+-0.022854 36970.677459+-2111.787757 Avg Perceptron 0.363954+-0.024588 0.433337+-0.031250 37482.347879+-3988.263142 kernel Last Perceptron 0.371754+-0.021299 0.422586+-0.030748 384.324955+-103.357849 kernel Vote Perceptron 0.352151+-0.045431 0.463472+-0.049069 14799.319818+-1688.544731

kernel avg Perceptron 0.375507+-0.023233 0.424742+-0.029058 13423.765702+-199.894576 Online LR 0.317697+-0.016178 0.500984+-0.019566 113526.530614+-2755.268273

Error Rate Cluster F1 Value Execution time(s)

Online CRP 0.147713 0.851655 54958

Online Last Perceptron 0.117643 0.890532 259512

Error Rate Execution time(s)

Online CRP 0.3602 112030

Online Last Perceptron 0.3888 2249000

是無法順利於理想時間(一個月)內跑完實驗。

於 RCV1(表 7)和 Wikipedia(表 8)的實驗中,其訓練資料量分別達到 50 萬和 160 萬,使用 kernel method [38] 之方法需計算 kernel matrix,我們使用的機器之記憶體 已無法建造此矩陣。另外由於訓練資料量大,其他方法都須要跑非常久,唯有 Online CRP 與 Online Last Perceptron 可以在理想時間(一個月)內跑完,而 Online CRP 又 比 Online Last Perceptron 快了許多。而且 Online Last Perceptron 之模型必須先給定 類別數參數,Online CRP 則不必,兩者的實驗效果在訓練資料量大的情況下是差不 多的。本論文提出的 Online CRP,不僅不須事先決定類別數參數,且效能甚至可贏 過須決定類別數參數的其他 Online Learning 方法。

此外,20newsgroup 是每個類別文章數皆為 1000 篇,而 RCV1 和 Wikipedia 兩 個資料集裡面,每個類別之文章數是極度不平均的,由實驗中亦可看出,本論文提 出之方法,在類別資料量平均和不平均的情況下,皆能有不錯的效能。

2. 與著名 superviesd 方法比較

我們更進一步的將監督式學習方法也依同樣的實驗步驟作實驗比較,得到以下 的結果:

20newsgroup

表 9: 20newsgroup 資料集與 supervised 方法效能比較表(5-fold 之平均值 ± 2 倍標準差)

20news Error Rate F1 value Execution time(s)

Online CRP 0.200980+-0.010022 0.679006+-0.022357 312.818196+-8.920450 SVM 0.203030+-0.009245 0.651600+-0.010391 5931.925530+-56.237568

LR 0.179275+-0.019520 0.692891+-0.028493 8576.386376+-315.337173 Naive Bayes 0.227584+-0.011982 0.613931+-0.021737 2909.171871+-30.390296

RCV

表 10 : RCV1 資料集與 supervised 方法更新模型比較表

Wikipedia

表 11 :Wikipedia 資料集與 supervised 方法更新模型比較表

從實驗中可看出,本論文提出之 Online CRP 的效能表現逼近監督式學習方法。

在 20newsgroup 的實驗中(表 9),就已經可明顯看出 Online CRP 比其他方法快了許 多,這是因為監督式學習方法,都有需要測試的參數,例如 Logical Regression 必 須挑選 regularization 參數 λ,SVM(linear)中必須挑選 penalty 參數 C,Naïve Bayes 中必須挑選 smoothing 參數 ,這些參數皆是用來避免訓練模型造成 overfitting 或

RCV Error Rate F1 value Execution time(s)

Online CRP 0.147713 0.851655 7023

SVM 0.0748 0.9318 346112

LR(lambda=30) 0.1409 0.8394 12367

Naive Bayes 0.18 0.7850 143831

Error Rate Execution time(s)

Online CRP 0.3602 7112

LR(lambda=30) 0.3488 40952

Naive Bayes 0.3887 389209

Online CRP 的表現介於 SVM 與 Naïve Bayes 之間,但是 Online CRP 更新十萬筆資 料只需約7000 秒,比其他監督式學習方法更新模型時間皆快速。

在 Wikipedia 實驗中(表 11),我們假設目前模型為從 150 萬筆訓練資料訓練 出來之模型,若此時另外新增十萬筆訓練資料,欲做模型更新的動作,可以發現 Online CRP 在 features 數 5 萬個的情況下,針對十萬筆新進的訓練資料作模型更新,

只需約7000 秒,Logical Regression 則必須花費 40952 秒;此外,SVM 在 Wikipedia 實驗中,已無法在理想時間內跑完實驗。

監督式學習的方法,在 Matlab 裡面皆須使用稀疏矩陣存取法,才可運算,否 則在資料量達到 60000 筆之後,就會出現記憶體不足之錯誤訊息,而 Online CRP 可用完全矩陣表示法來運算,這是因為系統一次針對一筆資料更新模型參數。由此 可見,當資料量達到稀疏矩陣表示法所能負載的瓶頸,或是資料並非在很多項是 0 的情況下,使用監督式學習方法將會面臨極大的困難。

另一方面,在實驗過程中,我們發現了在資料量達到某一個量後,本論文提出 之 Online CRP 的效能會漸趨穩定,以 RCV 資料集為例,針對本論文所提出之方法,

每隔一萬筆資料對相同的測試資料作測試並計算一次錯誤率,可得到下圖:

圖 4.5-1 : RCV1 資料集:Online CRP 每訓練一萬筆資料對一萬五千筆測試資料做預測之錯誤率。

1. Online CRP with Stochastic Gradient Descent trick

由 2.的討論中,我們知道了當訓練資料量達到某個量,我們的模型就已

經可以有不錯的效能表現,因此我們參考了 Léon Bottou 所整理的 Stochastic Gradient Descent Tricks[39]之概念,每隔一千點當成一個 period,定期計算 training error,並與上一次計算之 training error 相減,若此差值若低於某一個定值則收斂並 停止訓練,得到結果如下:

RCV1:

表 12: RCV 資料集:Online CRP 與使用 SGD trick 之 Online CRP 效能之比較

Wikipedia:

表 13:Wikipedia 資料集: Online CRP 與使用 SGD trick 之 Online CRP 效能之比較

圖 4.5-2:RCV1 資料集:Online CRP 每隔一千筆資料紀錄一次 training error。

Error Rate F1 value Execution time(s)

Online CRP 0.147713 0.851655 54958

Online CRP with SGD trick 0.1775 0.8118 1312

Error Rate Execution time(s)

Online CRP 0.3602 112030

Online CRP with SGD trick 0.3807 594

圖 4.5-3:Wikipedia 資料集:Online CRP 每隔一千筆資料記錄一次 training error。

由圖 4.5-2 和圖 4.5-3 可看出,Online CRP 之 training error 在資料量到達一 個數量後,最後此值會趨近於穩定。而由表 12 和表 13 中可以看出,本實驗提出之 方法,若加入 Stochastic Algorithm 的一些 trick,雖然效能比將全部訓練資料用來訓 練差了 2%~3%,但是模型訓練時間卻比原先快了好幾十倍。

2. 實驗總結

我們提出的 Online CRP 是無母數方法,因此模型是當遇到新類別的時候,才 會開始針對其類別參數做訓練,和其他本論文所提及之 Online Learning 方法都需事 先給定類別數參數之模型有很大的差異,然而 Online CRP 的表現卻不比其他 Online Learning 方法的差,且 Online CRP 之效能可以達到和監督式學習方法差不多的水 準,執行時間也比其他方法快很多,甚至可以進一步的引進 Stochastic 演算法常用 的技巧,可提早訓練出一個趨近穩定的模型,適合應用於巨量資料上。

第五章 結論與未來展望

5.1 研究總結

在大多的情況下,資料類別及個數資訊在巨量資料問題下是未知的,而且也 無法透過專家經驗或實驗方式得知,因此無母數方法比固定參數的機器學習方法更 適合處理巨量資料。在實驗中,當資料量大時,我們提出的 Online CRP 不僅在分 類的效能上能夠達到監督式學習方法的標準,且在執行時間也比很多方法快速,驗 證本方法可準確並有效率的處理巨量資料問題。

5.2 未來展望

目前有 online 概念的 graphical model 研究,大部分只研究主題隨時間的演變,

較少探討使用標記資料來對模型的參數估計做調整的問題,因此未來可能可以利用 標記資料來探討其他 graphical model 和 Online Learning 的結合。

標記資料引入 graphical model 在此論文是使用一個隨機變數來表示標記資料,

未來的方向可以在 graphical model 中多設計一些隨機變數,例如加入 Universum 的資料等等,來影響整個系統的機率參數之估計。

本論文提出的方法具動態的自我成長和自我訓練功能,並不排斥於對新領域的 即時學習與擴展,因此很適合整合成一套實務上的應用系統,也是未來可以考慮的 發展方向。此外,針對新訓量資料引進,參數一直在變動,可以由圖 4.5-1 中看出,

新訓練資料加進來,參數變動並不一定造成效能提升,因此未來可以考慮借用 Average Perceptron 之概念,將全部或部分參數紀錄下來,並使用所有參數預測 之平均的機率值來當預測值。

參考文獻

[1] T. Joachims, “Text categorization with support vector machines: Learning with many relevant features”, ECML, Berlin: Springer, pp. 137–142, 1998.

[2] R. E. Schapire and Y. Singer, “Boostexter: A boosting-based system for text categorization”, Machine Learning, vol. 39, no. 2/3, pp. 135–168, 2000.

[3] LEO BREIMAN , ”Random Forest” , Machine Learning, 45, 5–32, 2001, 2001 Kluwer Academic Publishers. Manufactured in The Netherland

[4] D. W. Hosmer and Stanley Lemeshow, Applied Logistic Regression, 2nd ed., Wiley, 2000.

[5] A. McCallum and K. Nigam, “A comparison of event models for naïve bayes text classification”, in IN AAAI-98 WORKSHOP ON LEARNING FOR TEXT CATEGORIZATION. AAAI Press, pp. 41–48, 1998.

[6] MacQueen, J. B. (1967). "Some Methods for classification and Analysis of Multivariate Observations". Proceedings of 5th Berkeley Symposium on Mathematical Statistics and Probability

[7] McLachlan, G., " Mixture Models." Marcel Dekker, New York, NY (1988) [8] Ferguson, Thomas (1973). "Bayesian analysis of some nonparametric

problems". Annals of Statistics 1 (2): 209–230.

[9] Aldous, D. J. (1985). "Exchangeability and related topics". É cole d'É té de Probabilités de Saint-Flour XIII — 1983. Lecture Notes in Mathematics1117.

pp. 1–1.

[10] Pitman. Combinatorial Stochastic Processes. Lecture Notes for St. Flour Summer School. Springer-Verlag, New York, NY, 2002.

[11] Navarro, D, & Perfors. A. “The Chinese restaurant process” University of Adelaide

[12] Kunle Olukotun, “Map-Reduce for Machine Learning on Multicore” in NIPS, 2006

[13] Léon Bottou “Large-Scale Machine Learning with Stochastic Gradient Descent”

Proceedings of COMPSTAT'2010, pp 177-186

[14] Shalev-Shwartz “Online Learning: Theory, Algorithms, and Applications”

Foundations and TrendsRin Machine Learning Vol. 4, No. 2 (2011) 107–194 [15] ROBERT E. SCHAPIRE “Large Margin Classification Using the Perceptron

Algorithm” 1999 Kluwer Academic Publishers, Machine Learning, 37, 277–

296 (1999)

[16] M. Hoffman, D. Blei, and F. Bach. Online learning for latent dirichlet allocation.

Advances in Neural Information Processing Systems, 23:856–864, 2010.

[17] Chong Wang, John Paisley, David M. Blei. Online variational inference for the hierarchical dirichlet process. In Proc. of the 14th Int'l. Conf. on Artificial Intelligence and Statistics (AISTATS), Vol. 15 (2011), pp. 752-760.

[18] Cauwenberghs and T. Poggio, "Incremental and Decremental Support Vector Machine Learning," in Adv. Neural Information Processing Systems

(NIPS*2000), Cambridge MA: MIT Press, vol. 13, 2001

[19] Fedor Zhdanov and Vladimir Vovk. “Competitive online generalized linear regression under square loss” , ECML 2010

[20] Daphne Koller, Nir Friedman, “Probabilistic Graphical Models: Principles and Technique” ,MIT Press, 2009

[21] Sethuraman, J. (1994), “A Constructive Definition of Dirichlet Priors,” Statistica Sinica, 4, pp. 639–650.29

[22] Blackwell, D. and MacQueen, J. (1973), “Ferguson Distributions via Polya ´ Urn Schemes,” Annals of Statistics, 1, pp. 353–355.

[23] Dempster, A.P.; Laird, N.M.; Rubin, D.B. (1977). "Maximum Likelihood from

Incomplete Data via the EM Algorithm". Journal of the Royal Statistical Society, Series B 39 (1): 1–38

[24] Neal “Markov chain sampling methods for Dirichlet process mixture models.”

Journal of Computational and Graphical Statistics, 9(2):249–265, 20001

[25] Blei, D., M. Jordan. Variational methods for the Dirichlet process.

In 21st International Conference on Machine Learning. 2004.

[26] D. M. Blei and P. I. Frazier. Distance dependent Chinese restaurant processes. In ICML, 2010.

[27] Richard Socher,Andrew Maas,Christopher D. Manning,” Spectral Chinese

[27] Richard Socher,Andrew Maas,Christopher D. Manning,” Spectral Chinese

相關文件