Created
December 9, 2015 07:19
-
-
Save AlexanderSavochkin/2a18c29f390263c18009 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Logistic regression example from Saprk documentation | |
val points = spark.textFile(...).map(parsePoint).cache() | |
var w = Vector.random(D) // current separating plane | |
for (i <- 1 to ITERATIONS) { | |
val gradient = points.map(p => | |
(1 / (1 + exp(-p.y*(w dot p.x))) - 1) * p.y * p.x | |
).reduce(_ + _) | |
w -= gradient | |
} | |
println("Final separating plane: " + w) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment