mahout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitriy Lyubimov (JIRA)" <>
Subject [jira] [Commented] (MAHOUT-1599) Add rand() operator to math-scala
Date Tue, 29 Jul 2014 17:46:53 GMT


Dmitriy Lyubimov commented on MAHOUT-1599:

there's a bunch of ephemeral views in Matrices class that provide it. Our ALS and SSVD stuff
uses it a lot. E.g. a view with values  from U(-1,1) 
     rndView = Matrices.symmetricUniformView(...)

if you want to materialize a random view (as a concrete modifiable matrix) you can clone it
in a matrix 

     rndView = Matrices.symmetricUniformView(...) cloned

I think there's currently support for U(-1,1), U(0,1) and N(0,1) matrix views.

Matrices also (i believe) contain methods that accept functions populating views. (functions
must provide idempotent filling of course in order for view to work). 

On top of it, there's some very brief functional support in math-scala too. 

There is a slight inconsistency in a sense that there are mahout-math notion of functions,
which are not compatible with scala functions (and there's, as it stands, no implicit conversion
for them). But it is generally also possible to populate a dense matrix with a function literal
in scala as well, e.g. : 

   rndA = new DenseMatrix(m,n) := { (r,c,v) => rnd.nextDouble }

As such, i think this patch is redundant 

> Add rand() operator to math-scala
> ---------------------------------
>                 Key: MAHOUT-1599
>                 URL:
>             Project: Mahout
>          Issue Type: Improvement
>          Components: Math
>    Affects Versions: 0.9
>            Reporter: Felix Schüler
>            Priority: Trivial
>              Labels: dsl, math, operator, random, scala
>         Attachments: MAHOUT-1599.patch
> I was looking at the scala-math operators and missed a rand(m, n) operator that generates
a m x n matrix filled with random numbers.
> I wanted random numbers from a uniform distribution over a specific interval so I implemented
a simple uniform random number generator.
> the rand(m, n, r) function takes any AbstractSamplerFunction and fills the matrix entries
with the numbers generated by its sample() method.

This message was sent by Atlassian JIRA

View raw message