Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View vrilleup's full-sized avatar

Li Pu vrilleup

  • Segway | Ninebot
View GitHub Profile
@vrilleup
vrilleup / spark-svd.scala
Last active August 9, 2023 17:32
Spark/mllib SVD example
import org.apache.spark.mllib.linalg.distributed.RowMatrix
import org.apache.spark.mllib.linalg._
import org.apache.spark.{SparkConf, SparkContext}
// To use the latest sparse SVD implementation, please build your spark-assembly after this
// change: https://github.com/apache/spark/pull/1378
// Input tsv with 3 fields: rowIndex(Long), columnIndex(Long), weight(Double), indices start with 0
// Assume the number of rows is larger than the number of columns, and the number of columns is
// smaller than Int.MaxValue