简体   繁体   English

使用Scala和Breeze实现梯度下降-错误:找不到参数op的隐式值:

[英]Implementing gradient descent with Scala and Breeze - error : could not find implicit value for parameter op:

I'm attempting to apply a gradient descent implementation in Scala and breeze based on Octave from : Gradient Descent implementation in octave 我试图在Scala和基于八度的微风中应用梯度下降实现,方法是: 八度中的梯度下降实现

The octave code I'm attempting to re-write is : 我尝试重写的八度代码是:

theta = theta -((1/m) * ((X * theta) - y)' * X)' * alpha;

I've come up with : 我想出了:

  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)

but im receiving a compile time error : 但我收到一个编译时错误:

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.

Have I implemented gradient descent correctly using Scala and Breeze ? 我是否已使用Scala和Breeze正确实现了梯度下降?

It seems I need to provide an implicit for - operator ? 看来我需要为提供一个隐含-操作?

    val myvalue = (mymatrix - ((1 / m) * (( (xv * mymatrix - yv).t * xv).t * .0001)

xv is Vector and the mymatrix is the Matrix which is unsupported . xv是向量,而mymatrix不受支持矩阵 that is the error u are encountering 那就是你遇到的错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Scala 微风错误:找不到参数的隐式值 - Scala breeze error: could not find implicit value for parameter 斯卡拉<console> :24: 错误: 找不到微风.storage.DefaultArrayValue [Any] 类型的证据参数的隐式值 - Scala <console>:24: error: could not find implicit value for evidence parameter of type breeze.storage.DefaultArrayValue[Any] Scala错误无法找到参数的隐式值 - Scala error Could not find implicit value for parameter Scala编译错误-找不到类型为证据的隐式值 - Scala compile error - could not find implicit value for evidence parameter of type 在Scala中找不到参数的隐式值 - Could not find implicit value for parameter in scala Vector上的Breeze argmax:找不到隐式值 - Breeze argmax on Vector: could not find implicit value Scala类型参数化,Shapeless-找不到参数Generic的隐式值 - Scala type parameterization, Shapeless - could not find implicit value for parameter Generic Scala,类型找不到参数n的隐式值 - Scala, Type could not find implicit value for parameter n 加特林scala扩展失败,找不到证据参数的隐式值 - Gatling scala extension fails with, could not find implicit value for evidence parameter 错误:找不到参数p的隐式值:scala.slick.jdbc.SetParameter [java.util.UUID] - Error:could not find implicit value for parameter p: scala.slick.jdbc.SetParameter[java.util.UUID]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM