I'd like to use
val ratings = data.map(_.split(',') match {
case Array(user,item,rate)
=>
Rating(user.toInt,item.toInt,rate.toFloat)
})
val model = ALS.train(ratings,rank,numIterations,alpha)
However, the user data i get are stored as Long. When switched to int, it may produce error. How can i do to solve the problem?
You can use one of ML implementations which support
Long
labels.RDD
version it is significantly less user friendly compared to other implementations:and returns only factors but
DataFrame
version returns a model: