2016-09-18 20 views
0

什麼函數用於計算某個數據點的預測。請看下面的代碼:哪個函數用於Sparks中的預測Mllib

final LogisticRegressionModel model = logisticRegression.run(train.rdd()); 
point = train.rdd().take(0); 
Double prediction = model.predict(point.features()); 

我想是會

enter image description here

,但我無法找到實現該功能的文檔。

回答

3

它使用一個標準的邏輯功能(Ÿ公式中是出位):

enter image description here

其中is implemented as

val margin = dot(weightMatrix, dataMatrix) + intercept 
val score = 1.0/(1.0 + math.exp(-margin)) 

要獲取原始值,你應該clearThreshold

+0

謝謝。所以我幾乎是正確的。 –