[英]Implementing gradient descent with Scala and Breeze - error : could not find implicit value for parameter op:
我試圖在Scala和基於八度的微風中應用梯度下降實現,方法是: 八度中的梯度下降實現
我嘗試重寫的八度代碼是:
theta = theta -((1/m) * ((X * theta) - y)' * X)' * alpha;
我想出了:
val xv = DenseVector[Double](1.0, 1.0)
val yv = DenseVector[Double](1.0, 1.0)
val mymatrix : DenseMatrix[Double] = DenseMatrix( (1.0,2.0) , (3.0,4.0) )
val myvalue = (mymatrix - ((1 / m) * (( (xv * mymatrix - yv).t * xv).t * .0001)
但我收到一個編譯時錯誤:
Multiple markers at this line:
◾could not find implicit value for parameter op: breeze.linalg.operators.OpSub.Impl2[breeze.linalg.DenseMatrix[Double],breeze.linalg.DenseVector[Double],That]
◾not enough arguments for method -: (implicit op: breeze.linalg.operators.OpSub.Impl2[breeze.linalg.DenseMatrix[Double],breeze.linalg.DenseVector[Double],That])That. Unspecified value parameter op.
我是否已使用Scala和Breeze正確實現了梯度下降?
看來我需要為提供一個隱含-
操作?
val myvalue = (mymatrix - ((1 / m) * (( (xv * mymatrix - yv).t * xv).t * .0001)
xv
是向量,而mymatrix
是不受支持的矩陣 。 那就是你遇到的錯誤
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.