Closed XiaodanLi123 closed 3 years ago
def pca(data: DenseMatrix[Double], components: Int) = { val d = zeroMean(data) //val (, , v) = breeze.linalg.svd(d.t) val SVD(, , v) = svd(d.t) val model = v(0 until components, ::) //top 'components' eigenvectors println(model) }
UserPatternDetection/UserPatternAnomalyTest.scala:14: could not find implicit value for parameter impl: breeze.linalg.svd.Impl[Unit,VR]
@XiaodanLi123 where is that zeroMean function coming from? It looks like d.t is not a matrix (it's a Unit/void type instead). Please make sure that d.t is a matrix.
def pca(data: DenseMatrix[Double], components: Int) = { val d = zeroMean(data) //val (, , v) = breeze.linalg.svd(d.t) val SVD(, , v) = svd(d.t) val model = v(0 until components, ::) //top 'components' eigenvectors println(model) }
UserPatternDetection/UserPatternAnomalyTest.scala:14: could not find implicit value for parameter impl: breeze.linalg.svd.Impl[Unit,VR]