You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@systemml.apache.org by Janardhan <ja...@apache.org> on 2019/01/15 04:40:30 UTC

Autoencoder codegen testing with R

Hi,

I have replicated AutoEncoder-2layer script in R. But, can the output files
(W1, b1, ...) will match the R script. (not matching in my implementation).

Because, we have used Rand functions without seed in dml script also R
doesn't provide any Rand(.., seed=..) function. I have just used

*IN DML : Rand(m, n, min=-1, max=1)*
*IN R: runif(n, min=-1, max=1) %*% matrix(1, m, 1) *

Should the results from Autoencoder-2layer.dml will match with that of R
script.

Thanks,
Janardhan

Re: Autoencoder codegen testing with R

Posted by Janardhan <ja...@gmail.com>.
Hi Matthias,

I have created DML and R script, and passed random matrices from java test
class. All the test have passed.
Link: https://github.com/apache/systemml/pull/861

Kindly, provide some comments, when you come this way?.

Thank you,
Janardhan

On Tue, Jan 15, 2019 at 3:58 PM Matthias Boehm <mb...@gmail.com> wrote:

> yes, you're absolutely right - in this form, results would always
> differ. Even if we feed a seed to both R and DML scripts, the
> implementation of our rand is very different as we need to ensure that,
> given a seed, we generate the same data in local and distributed
> operations. Accordingly, we derive seeds for each 1K x 1K block from the
> initial seed.
>
> For testing purposes, we usually use one of the following two
> approaches: (1) use constant matrices or sequences (matrix/seq), or (2)
> generate the random data outside and read it into both scripts.
> Accordingly, I would recommend to create a copy of the dml script, place
> it inside the test directory, and modify the script accordingly.
>
> Regards,
> Matthias
>
> On 15/01/2019 05:40, Janardhan wrote:
> > Hi,
> >
> > I have replicated AutoEncoder-2layer script in R. But, can the output
> files
> > (W1, b1, ...) will match the R script. (not matching in my
> implementation).
> >
> > Because, we have used Rand functions without seed in dml script also R
> > doesn't provide any Rand(.., seed=..) function. I have just used
> >
> > *IN DML : Rand(m, n, min=-1, max=1)*
> > *IN R: runif(n, min=-1, max=1) %*% matrix(1, m, 1) *
> >
> > Should the results from Autoencoder-2layer.dml will match with that of R
> > script.
> >
> > Thanks,
> > Janardhan
> >
>

Re: Autoencoder codegen testing with R

Posted by Matthias Boehm <mb...@gmail.com>.
yes, you're absolutely right - in this form, results would always 
differ. Even if we feed a seed to both R and DML scripts, the 
implementation of our rand is very different as we need to ensure that, 
given a seed, we generate the same data in local and distributed 
operations. Accordingly, we derive seeds for each 1K x 1K block from the 
initial seed.

For testing purposes, we usually use one of the following two 
approaches: (1) use constant matrices or sequences (matrix/seq), or (2) 
generate the random data outside and read it into both scripts. 
Accordingly, I would recommend to create a copy of the dml script, place 
it inside the test directory, and modify the script accordingly.

Regards,
Matthias

On 15/01/2019 05:40, Janardhan wrote:
> Hi,
> 
> I have replicated AutoEncoder-2layer script in R. But, can the output files
> (W1, b1, ...) will match the R script. (not matching in my implementation).
> 
> Because, we have used Rand functions without seed in dml script also R
> doesn't provide any Rand(.., seed=..) function. I have just used
> 
> *IN DML : Rand(m, n, min=-1, max=1)*
> *IN R: runif(n, min=-1, max=1) %*% matrix(1, m, 1) *
> 
> Should the results from Autoencoder-2layer.dml will match with that of R
> script.
> 
> Thanks,
> Janardhan
>