This commit is contained in:
Jianping J Wang 2013-12-30 23:42:55 +08:00
parent 29fe6bdaa2
commit 600421d8bc

View file

@ -13,12 +13,13 @@ class SvdppSuite extends FunSuite with LocalSparkContext {
test("Test SVD++ with mean square error on training set") {
withSpark { sc =>
val SvdppErr = 0.01
val SvdppErr = 0.2
val edges = sc.textFile("mllib/data/als/test.data").map { line =>
val fields = line.split(",")
Edge(fields(0).toLong * 2, fields(1).toLong * 2 + 1, fields(2).toDouble)
}
val graph = Svdpp.run(edges)
val conf = new SvdppConf(10, 2, 0.0, 5.0, 0.007, 0.007, 0.005, 0.015)
val graph = Svdpp.run(edges, conf)
val err = graph.vertices.collect.map{ case (vid, vd) =>
if (vid % 2 == 1) { vd.norm } else { 0.0 }
}.reduce(_ + _) / graph.triplets.collect.size