Skip to content

Commit

Permalink
compure score once
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxr committed Nov 11, 2014
1 parent ad678e9 commit 494b632
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,10 @@ class LogisticRegressionModel private[ml] (
1.0 / (1.0 + math.exp(-margin))
}
val t = map(threshold)
val predict: Vector => Double = (v) => {
if (score(v) > t) 1.0 else 0.0
val predict: Double => Double = (score) => {
if (score > t) 1.0 else 0.0
}
dataset.select(
Star(None),
score.call(map(featuresCol).attr) as map(scoreCol),
predict.call(map(featuresCol).attr) as map(predictionCol))
dataset.select(Star(None), score.call(map(featuresCol).attr) as map(scoreCol))
.select(Star(None), predict.call(map(scoreCol).attr) as map(predictionCol))
}
}

0 comments on commit 494b632

Please sign in to comment.