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

scala for/yield on instance of class

I am scratching my head on an example I've seen in breeze's documentation about distributions. After creating a Rand instance, they show that you can do the following: import breeze.stats.distributions._ val pois = new Poisson(3.0); val doublePoi:…
1
vote
1 answer

Simple neural network using linear algebra and scala breeze

Below is my implementation of a neural network with 1 input layer, two hidden layers and 1 output layer : import breeze.linalg._ import breeze.math._ import breeze.numerics._ object NN extends App { //Forward propogation val x1 =…
blue-sky
  • 51,962
  • 152
  • 427
  • 752
1
vote
1 answer

Operations betzeen matrix and scalar in breeze

Adendo: This seems to be a scala IDE bug because everythong compiles and run smoothly by using the command line sbt. I'd close the question, but StackOverflow won't allow I am unable to sum or multiply a matrix by a scalar in Breeze If I try: val z…
user2759511
  • 640
  • 7
  • 16
1
vote
1 answer

Workaround for a scala.language.dynamics bug in scala 2.10 compiler

I've been trying to generate an SBT build for an open source project that I'd like to reference from within my project, and I ran into what seems to be a compiler bug. The following code compiles and runs as expected in eclipse/scala-ide, but the…
philwalk
  • 634
  • 1
  • 7
  • 15
1
vote
1 answer

Creating a DenseMatrix from a Transpose

I started using Breeze since a few weeks and I am not able to do something that seems simple. I want to transform a Transpose into a DenseMatrix, for example: val matrix = DenseMatrix((1.0, 3.5), (3.0, 2.0)) // DenseMatrix val meanCols =…
Armand Grillet
  • 3,229
  • 5
  • 30
  • 60
1
vote
1 answer

Scala Breeze: can you create a DenseMatrix of Int Array elements?

I just found Scala Breeze as a high performance linear algebra library for Scala applications. I wonder if there is a way to initialize a DenseMatrix with an Int Array as element unit. This is the OpenCV functionality i am trying to port to…
Ignacio
  • 135
  • 1
  • 2
  • 8
1
vote
1 answer

Converting vector of vectors to Matrix in scala

What is the most efficient way to convert breeze.linalg.Vector[breeze.linalg.Vector[Double]] to a DenseMatrix? I tried using asDenseMatrix, toBreezeMatrix, creating a new DenseMatrix etc but it seems like I am missing the most simple and obvious way…
Pradeep Vairamani
  • 4,004
  • 3
  • 36
  • 59
1
vote
2 answers

Multiply elements in dataframe column by same value

With pandas/numpy, a 2x2 matrix multiplied with a 2x1 matrix will result in each column in 2x2 matrix by corresponding column value in 2x1 matrix. Ex. The following with numpy >>> data = np.array([[1, 2], [3, 4]]) >>> data array([[1, 2], [3,…
1
vote
1 answer

intellij error when importing scala breeze

I am trying to import the scala breeze project that I have downloaded from github with intellij. I import it as sbt project and then I get the following error: 14:16:48 SBT project import [warn] Credentials file…
Donbeo
  • 17,067
  • 37
  • 114
  • 188
1
vote
1 answer

how to append to a file using scala/breeze library

I wish to write to a file the output row of result matrix (produced in iterations) so that I can support checkpointing. I figured we can use the csvwrite command to write the entire matrix to a file but how can I append to a file? I am looking…
john x
  • 21
  • 5
1
vote
2 answers

Scala Breeze Dirichlet distribution parameter estimation

I am trying to estimate parameters (Dirichlet distribution) for a data set using Scala's breeze lib. I already have a working python (pandas/dataframes) and R code for it but I was curious as to how to do it in Scala. Also I am new to Scala. I cant…
cryp
  • 2,285
  • 3
  • 26
  • 33
1
vote
0 answers

row-broadcasting and transposed vectors?

I'm trying to add a row vector to each row of a matrix: val M = DenseMatrix((1.0,2.0,3.0), (4.0,5.0,6.0)) val row = DenseVector(3.0,4.0,5.0).t val result = M(*,::) + row // error: could not find implicit value for parameter //…
arya
  • 946
  • 5
  • 14
1
vote
1 answer

Is there a mechanism in Scala Breeze where I can add to DenseVectors without having to code it myself?

For example, if I have two dense vectors: val a = DenseVector(1.0, 2.0) -and- val b = DenseVector(3.0, 4.0) and I wish to add them, is there something like a add function I can pass them two within the breeze library that would make my life easier…
Ego
  • 585
  • 1
  • 8
  • 18
1
vote
2 answers

multiply constant with vector in breeze

I am new to breeze. Please help with this formula I have a Vector called data, a constant called alpha, and another Vector called delay. I want to generate an output Vector adjData. The elemental operation is adjData_i = (1 - alpha *…
bhomass
  • 3,414
  • 8
  • 45
  • 75
1
vote
1 answer

Scala Breeze adding row and column header to DenseMatrix

Below is an example of code which will generate Correlation Matrix but I need to add column header and row header in front and top of matrix. For example in the above matrix amber coloured objects are the labels which i need to add to the blue…
user3341078
  • 449
  • 1
  • 5
  • 16