WeibullDistribution example

37 views
Skip to first unread message

Gregg Sirrine

unread,
Jul 20, 2016, 1:05:45 PM7/20/16
to Scala Breeze
Hi, I'm trying to port some R-Script code to Scala. The key piece of the R-Script is a call to dweibull

GE17PC = read.csv(powercurvefile)
shape
= dweibull(GE17PC$X, weibull_k, weibull_A)*.5

The R-Script call accepts a vector as the first argument. I don't understand how to replicate this call in Scala. When I saw the existence of the WeibullDistribution class in Breeze, I figured I was home free and it would be a trivial translation. However, all my attempts end in compilation errors. It's clear I don't know what I'm doing. 

Error:(43, 58) could not find implicit value for parameter impl: breeze.stats.distributions.WeibullDistribution.Impl3[breeze.linalg.DenseVector[Double],Double,Double,VR]
        val wd: DenseVector[Double] = WeibullDistribution(myMatrix(pcColumns.indexOf(0),  ::).t, weibull_k, weibull_A)

When I saw this error I thought I must be missing an import for some implicits. However, after reading some posts here I'm beginning to wonder if I have to implement some kind of UFunc class or iterate through the values in my vector, calling the weibull class. But I am a little clueless on both ideas.

Can anyone point me to an example using the WeibullDistribution class?

David Hall

unread,
Jul 28, 2016, 9:14:45 PM7/28/16
to scala-...@googlegroups.com
sorry, I lost this in my inbox. the weibull distribution (like most distributions in breeze) isn't vectorized right now, so you have to do a map over the densevector

--
You received this message because you are subscribed to the Google Groups "Scala Breeze" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-breeze...@googlegroups.com.
To post to this group, send email to scala-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scala-breeze/37bf7d2c-01b1-496d-bd25-53a904bf248c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages