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
2 answers

Is there a more Scala-esque way to impelent this vector processing function?

I'm really new to Scala, and I've been trying to implement a function which is given two Scala Breeze DenseVectors that are equal length. Both vectors contain double values and NaNs. The function iterates over both vectors and checks if at the…
P4nd4b0b3r1n0
  • 1,951
  • 3
  • 22
  • 31
1
vote
2 answers

how to calculate the Inverse of the normal cumulative distribution function (cdf) using scala breeze?

I would like to calculate Inverse of the normal cumulative distribution function (cdf) using scala breeze similar to MATLAB function NORMINV. But i did not find any builtin function to calculate it. could anybody has any ideas to do it in…
1
vote
1 answer

Converting matrix to array row by row in Breeze

Trying to convert a DenseMatrix to an array row by row. Method .toArray does it column by column. -0.04202212765812874 0.001493146410211921 0.06454376876354218 -0.0281160194426775 -0.003562772646546364 …
FranGoitia
  • 1,965
  • 3
  • 30
  • 49
1
vote
1 answer

Scala Breeze expansion matrix

In Octave/Matlab I can expand an identity matrix as follows. >> I = eye(3) I = Diagonal Matrix 1 0 0 0 1 0 0 0 1 >> A = [ 3 2 3 2 2 1 3 2 2 1 ] >> E = I(:, A) E = 0 0 0 0 0 1 0 0 0 1 0 1 0 1 1 0 …
botkop
  • 934
  • 1
  • 8
  • 17
1
vote
1 answer

Converting Map[Int, Double] to breeze.linalg.SparseVector

I am new to the Breeze library and I would like to convert a Map[Int, Double] to breeze.linalg.SparseVector, and ideally without having to specify a fixed length of the SparseVector. I managed to achieve the goal with this clumsy code: import…
user267817
1
vote
0 answers

Can't use breeze even after I added dependencies to build.sbt

I was following this tutorial on installing breeze, but I can't get it to work. My directory structure: myproject/ build.sbt project/ Build.scala # This is empty src/ main/ scala/ hello.scala test/ scala/ …
Akavall
  • 82,592
  • 51
  • 207
  • 251
1
vote
2 answers

Why is DenseVector a mutable collection?

Usually (so far always) I try to use immutable collection in Scala, especially so that if I give a reference to a collection to some other part of my program I cannot override the original source by accident. Using breeze, I would like to know: Why…
Make42
  • 12,236
  • 24
  • 79
  • 155
1
vote
0 answers

Should I use Scala's NaN or an "indicator vector"?

I build a program based on a rather complex mathematical algorithm. In this I want to account for vectors that have missing values, so NaN. Until now I implemented those by having two vectors - both implemented with breeze's DenseVector[Double]: a…
Make42
  • 12,236
  • 24
  • 79
  • 155
1
vote
2 answers

Converting a Row Matrix into a Breeze Dense Matrix

I have an MLLIB distributed row matrix in which row order doesn't matter. Is there any way to easily convert this into a breeze dense matrix? I'd imagine a row-by-row mapping might work, but I'm relatively unfamiliar with breeze as a whole. Edit:…
mongolol
  • 941
  • 1
  • 13
  • 31
1
vote
0 answers

Position of toList on Scala iterator changes output strangely

I am writing an iterative optimization algorithm in Scala. The function UpdateBG inputs a 2-tuple and outputs an updated 2-tuple. I establish an iterator to apply this update as many times as required until convergence (when the relative change in…
Lindon
  • 1,292
  • 1
  • 10
  • 21
1
vote
0 answers

Is Breeze worth the dependency?

I am programming a machine learning algorithm in Scala. For that one I don't think I will need matrices, but I will need vectors. However, the vectors won't even need a dot product, but just element-wise operations. I see two options: use a linear…
Make42
  • 12,236
  • 24
  • 79
  • 155
1
vote
1 answer

Is the Scala Breeze package thread safe for use in Spark Dataframe processing?

Does the use of ThreadLocal for singleton variables make them thread safe for use in Spark Dataframe processing framework? The Breeze fourierTr functions use ThreadLocal and it seems to cause problems for me. I am building an application to…
Tim Ryan
  • 1,010
  • 2
  • 11
  • 19
1
vote
0 answers

NoSuchMethodError when using scala breeze lib for meanAndVariance method, but able to use percentile

I have a spark streaming application that is reading data off a Kinesis Stream and aggregating metrics gathered from that data. My problem is that I want to use breeze to get descriptive stat values given a distribution of data, like mean, variance…
yash.vyas
  • 163
  • 2
  • 7
1
vote
0 answers

Tell Spark to use the version of Breeze I want

I use Breeze for an algorithm that I wish to deploy in a cluster using Spark. When running my algorithm on Spark, I get the error java.lang.NoSuchMethodError: breeze.linalg.sum$.helper_Double()Lbreeze/linalg/VectorizedReduceUFunc$VectorizeHelper;.…
Armand Grillet
  • 3,229
  • 5
  • 30
  • 60
1
vote
1 answer

Building a SparseVector out of values in a DataFrame

I've been trying to extract information out of a 1-column Spark Dataframe consisting of Doubles and put it into a Breeze SparseVector. To do this, I go through every element of my 1-column DataFrame, force it to be a Double, then add it to the…
Kevin Wang
  • 78
  • 1
  • 7