update
This commit is contained in:
parent
29fe6bdaa2
commit
600421d8bc
|
@ -13,12 +13,13 @@ class SvdppSuite extends FunSuite with LocalSparkContext {
|
||||||
|
|
||||||
test("Test SVD++ with mean square error on training set") {
|
test("Test SVD++ with mean square error on training set") {
|
||||||
withSpark { sc =>
|
withSpark { sc =>
|
||||||
val SvdppErr = 0.01
|
val SvdppErr = 0.2
|
||||||
val edges = sc.textFile("mllib/data/als/test.data").map { line =>
|
val edges = sc.textFile("mllib/data/als/test.data").map { line =>
|
||||||
val fields = line.split(",")
|
val fields = line.split(",")
|
||||||
Edge(fields(0).toLong * 2, fields(1).toLong * 2 + 1, fields(2).toDouble)
|
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) =>
|
val err = graph.vertices.collect.map{ case (vid, vd) =>
|
||||||
if (vid % 2 == 1) { vd.norm } else { 0.0 }
|
if (vid % 2 == 1) { vd.norm } else { 0.0 }
|
||||||
}.reduce(_ + _) / graph.triplets.collect.size
|
}.reduce(_ + _) / graph.triplets.collect.size
|
||||||
|
|
Loading…
Reference in a new issue