You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@systemds.apache.org by GitBox <gi...@apache.org> on 2020/10/28 17:44:29 UTC
[GitHub] [systemds] phaniarnab commented on a change in pull request #1089: [MINOR] Add seed to kmeans
phaniarnab commented on a change in pull request #1089:
URL: https://github.com/apache/systemds/pull/1089#discussion_r513641937
##########
File path: scripts/builtin/kmeans.dml
##########
@@ -86,7 +87,11 @@ m_kmeans = function(Matrix[Double] X, Integer k = 10, Integer runs = 10, Integer
# Select the i-th centroid in each sample as a random sample row id with
# probability ~ min_distances:
- random_row = rand(rows = 1, cols = num_runs);
+ if (seed == -1){
+ random_row = rand(rows = 1, cols = num_runs);
+ } else{
+ random_row = rand(rows = 1, cols = num_rows, seed = seed);
+ }
Review comment:
Only one rand call should be sufficient. If not, I suggest to replace this with a single `ifelse` call.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org