You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by mb...@apache.org on 2017/10/16 00:04:06 UTC

systemml git commit: [MINOR] Fix consistency ALS datagen script (factor names, cleanup)

Repository: systemml
Updated Branches:
  refs/heads/master 33559144c -> 06b4b9d5f


[MINOR] Fix consistency ALS datagen script (factor names, cleanup)

This patch cleans up the ALS data generation script to use the same
factor names as ALS-CG and remove unnecessary operations.


Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/06b4b9d5
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/06b4b9d5
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/06b4b9d5

Branch: refs/heads/master
Commit: 06b4b9d5ff04f09c61d44864d36a65b31527bbb3
Parents: 3355914
Author: Matthias Boehm <mb...@gmail.com>
Authored: Sun Oct 15 17:04:31 2017 -0700
Committer: Matthias Boehm <mb...@gmail.com>
Committed: Sun Oct 15 17:04:31 2017 -0700

----------------------------------------------------------------------
 scripts/datagen/genRandData4ALS.dml | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/06b4b9d5/scripts/datagen/genRandData4ALS.dml
----------------------------------------------------------------------
diff --git a/scripts/datagen/genRandData4ALS.dml b/scripts/datagen/genRandData4ALS.dml
index a5838d7..eb9a4a9 100644
--- a/scripts/datagen/genRandData4ALS.dml
+++ b/scripts/datagen/genRandData4ALS.dml
@@ -20,8 +20,8 @@
 #-------------------------------------------------------------
 
 Xfile = $X; # input matrix X of size m x n
-Wfile = $W; # original row factor of size m x r
-Hfile = $H; # original col factor of size r x n
+Ufile = $U; # original row factor of size m x r
+Vfile = $V; # original col factor of size r x n
 m = $rows; # no. of rows of X
 n = $cols; # no. of cols of X
 r = $rank; # rank of factorization
@@ -30,15 +30,18 @@ sigma = ifdef ($sigma, 0.01); # variance of Gaussian noise
 fmt = ifdef ($fmt, "binary"); # output format
 
 # generate original factors by sampling from a normal(0,1.0) distribution
-W = rand(rows = m, cols = r, pdf = "normal", seed = 123);
-H = rand(rows = r, cols = n, pdf = "normal", seed = 456);
+U = rand(rows = m, cols = r, pdf = "normal", seed = 123);
+V = rand(rows = n, cols = r, pdf = "normal", seed = 456);
 
 I = floor(rand(rows = nnz, cols = 1, min = 1, max = m + 0.999999999));
 J = floor(rand(rows = nnz, cols = 1, min = 1, max = n + 0.999999999));
 X = rand(rows = nnz, cols = 1, pdf = "normal") * sqrt(sigma);
 N = table(I, J, X);
-T = (N != 0);
-X = T * (W %*% H) + T * N;
+X = (N != 0) * (U %*% t(V)) + N;
 write(X, Xfile, format = fmt);
-write(W, Wfile, format = fmt);
-write(H, Hfile, format = fmt);
+if( Ufile != " " )
+  write(U, Ufile, format = fmt);
+if( Vfile != " " ) {
+  V = t(V);
+  write(V, Vfile, format = fmt);
+}