Questions tagged [scala-breeze]

Breeze is a linear algebra library for Scala.

Breeze is a linear algebra library for Scala.

From the project's GitHub page:

Breeze is a library for numerical processing, machine learning, and natural language processing. Its primary focus is on being generic, clean, and powerful without sacrificing (much) efficiency. Breeze is the merger of the ScalaNLP and Scalala projects, because one of the original maintainers is unable to continue development.

197 questions
1
vote
1 answer

How to install Scala Breeze on Mac (not using sbt)

I have installed the Breeze package using sbt. But it looks like that the sbt's scala is a different installation than the default scala repl on my Mac. I would like to install Breeze on the default scala installation. But I don't know…
Alt
  • 2,597
  • 5
  • 26
  • 36
1
vote
1 answer

Forward reference error in a for loop Scala

This is a code that is written in Scala : for (i <- 0 until 10) { if (i > 0) { val new = theta(i * 5) } // using variable new val theta = DenseVector.zeros[Int]((i + 1) * 10) // doing operations on theta } every iteration has own…
AHAD
  • 239
  • 4
  • 16
1
vote
1 answer

Scala (Breeze) + Intellij: "Cannot resolve symbol *"

I'm using Breeze to to do sum simple linear algebra operations on dense matrices. I'm using the Intellij IDEA. Here is an snippet of my code: import breeze.linalg._ val X1:DenseMatrix[Double] = DenseMatrix.zeros[Double](10, 5) + 1.0 val n1 :…
Alt
  • 2,597
  • 5
  • 26
  • 36
1
vote
1 answer

How to convert a sequence variable into a matrix in Scala

This should be easy, but I'm stuck. I'm trying to convert a Seq[Seq[Double]] type into a Breeze DenseMatrix. (all nested Seq[Double]'s have the same number of elements.) Converting a single sequence to a DenseVector is pretty easy: val…
Alt
  • 2,597
  • 5
  • 26
  • 36
1
vote
1 answer

Sequentially updating columns of a Matrix RDD

I'm having philosophical issues with RDDs used in mllib.linalg. In numerical linear algebra one wants to use mutable data structure but since in Spark everything (RDDs) is immutable, I'd like to know if there's a way around this, specifically for…
1
vote
1 answer

java.lang.NoSuchMethodError: breeze.linalg.squaredDistance

I want to run a Spark Streaming program on a cluster. Despite my program runs correctly locally on my machine, run on the cluster problem. In fact, I get this error as: java.lang.NoSuchMethodError:…
Momog
  • 567
  • 7
  • 27
1
vote
0 answers

How to build Breeze by command "sbt assembly"?

I try to build Breeze by command "sbt assembly" in intellij idea. However, it told me that "Not a valid command: assembly" which makes me very confused. Because the codes in the default plugin.sbt seems it supports command "sbt assembly" resolvers…
Mark
  • 369
  • 1
  • 3
  • 5
1
vote
1 answer

No ClassTag available for Vec[Double]

I am kind of new to scala and spark. Now I would like to generate a vector on each of the worker. When I use this line, I got two errors: val b = sc.parallelize(1 to n, n).map( i => DenseVector[Double]](10.0,20.0,30.0,40.0)) No ClassTag available…
pc27149
  • 21
  • 3
1
vote
0 answers

Slicing and updating non-contiguous indices in a DenseVector in Breeze

I want to do something like the following. Equivalent code in NumPy a = np.zeros(5) a[np.array([1, 2, 4])] += [1, 2, 3] a array([ 0., 1., 2., 0., 3.]) I tried the following but it does not work. val v = DenseVector.zeros[Double](5) v(1, 2, 4)…
Manoj
  • 961
  • 4
  • 11
  • 37
1
vote
1 answer

Where are low level implementations for transpose (DenseMatrix or DenseVector) in Scala breeze?

Behind the .t(..) // .t() is transpose method of [DenseVector|DenseMatrix] is a relative labyrinthe of implicits, traits, and class hierarchies. Some of the pieces: trait CanTranspose class/object Transpose and associated…
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
1
vote
1 answer

Scala Breeze: Solution to a complex system of linear equations

I need to find a solution to a complex system of linear equations. Current implementation is in C++ and calls LAPACK zgesv function. I thought about rewriting it in Scala and using Breeze for linear algebra. I try an example import…
1
vote
1 answer

How to round DenseVector in Scala breeze?

In below code how can I round values of DenseVector to one decimal place. DenseVector value should be : DenseVector(0.4, 0.4, 0.2) instead of : DenseVector(0.36000000003540067, 0.35999999990731946, 0.18000000005727962) I have tried using round…
blue-sky
  • 51,962
  • 152
  • 427
  • 752
1
vote
1 answer

Why does Breeze binomial distribution return NaN when it should return 1.0?

The following gives NaN, but should give 1.0, why? breeze.stats.distributions.Binomial(10, 1.0).probabilityOf(10) similarily for Binomial(1, 0.0).probabilityOf(0)
samthebest
  • 30,803
  • 25
  • 102
  • 142
1
vote
2 answers

Importing in Scala - How to add a jar to the classpath permanently

So I'm having trouble importing a package in scala. I downloaded the package, breeze, from github, because I wanted to sample from probability distributions. I'm used to Python, where I can just download a package, include it in the path, and…
sinwav
  • 724
  • 1
  • 7
  • 20
1
vote
1 answer

Matrix Row manipulation in Breeze using Scala?

I've a DenseMatrix 1 2 3 0 0 0 0 0 0 0 0 0 11 22 33 0 0 0 0 0 0 0 0 0 111 222 333 I want to remove the first row and then a last row with all 0s 0 0 0 11 22 33 0 0 0 0 0 0 0 0 …
Soumya Simanta
  • 11,523
  • 24
  • 106
  • 161