我嘗試使用邏輯迴歸多項式功能,幸運的是它對我來說工作得很好,而且我能夠繪製決策曲線。我已經使用map_feature函數來獲得多項式特徵。 (我把安德魯教授關於邏輯迴歸的註釋轉化爲正則化):http://openclassroom.stanford.edu/MainFolder/DocumentPage.php?course=MachineLearning&doc=exercises/ex5/ex5.html繪製高斯內核邏輯迴歸決策曲線
現在我試圖用高斯內核來取代多項式特徵。幸運的是,我的成本函數(j_theta)可以正常工作,並在每次迭代後都會減少,並獲得最終的theta值。 ,我現在面臨的問題是如何繪製這裏的決策邊界
I am using Octave to develop the algorithms and plot the graphs..
下面是詳細信息到我的數據集大小
原始數據集:
Data Set (x): [20*3] where the first column is the intercept or the bias column
1.00 2.0000 1.0000
1.00 3.0000 1.0000
1.00 4.0000 1.0000
1.00 5.0000 2.0000
1.00 5.0000 3.0000
.
.
.
數據設定Gaussian Kernal實施後的新功能
Data set (f) : [20*21] the first column is the intercept column with all values as 1
1.0000e+000 1.0000e+000 6.0653e-001 1.3534e-001 6.7379e-003 . . . . . . . .
1.0000e+000 6.0653e-001 1.0000e+000 6.0653e-001 8.2085e-002 . . . . . . . .
1.0000e+000 1.3534e-001 6.0653e-001 1.0000e+000 3.6788e-001
1.0000e+000 6.7379e-003 8.2085e-002 3.6788e-001 1.0000e+000
. .
. .
. .
. .
. .
成本函數圖,我在我的新功能的數據集(F)應用梯度下降後得到的是:
因此,我把我的新THETA值:
theta: [21*1]
3.8874e+000
1.1747e-001
3.5931e-002
-8.5937e-005
-1.2666e-001
-1.0584e-001
.
.
.
的問題,我現在面對的是如何構建我的決策曲線在具有新特徵數據集和theta值的原始數據集上。我不知道該如何着手。
我會很高興,如果我得到一些線索,或教程,或鏈接,可以幫助我解決我的問題。
感謝您的幫助。謝謝
嗨Greeness,我看到了帖子,其實劇情是適用於2D,但是當我考慮Logistic迴歸或使用高斯核SVM我的特點變成訓練組數。也就是說,雖然我的原始特徵只有兩個,但當我使用高斯核時,我的新特徵集轉換爲訓練集的數目。因此我的theta是從m(不是訓練集)維的新特徵集中學習的。我想知道是否有某種方法可以將數據轉換回2D特徵集並獲得決策邊界。 – Sam 2014-10-24 07:15:31