regaleo605 commented on code in PR #1888:
URL: https://github.com/apache/systemds/pull/1888#discussion_r1306372930


##########
scripts/builtin/imputeByKNN.dml:
##########
@@ -76,30 +79,32 @@ m_imputeByKNN = function(Matrix[Double] X, String 
method="dist", Int seed=-1)
     #Get the minimum distance row-wise computation
     minimum_index = rowIndexMin(distance_matrix)
 
-    #Position of missing values in per row in which column
-    position = rowSums(is.nan(X))
-    position = position * minimum_index
+    #Loop through each column
+    parfor(i in 1:nrow(missing_col_index), check = 0){
+      #Position of missing values in per row in which column
+      position = masked[,as.scalar(missing_col_index[i,1])]
+      position = position * minimum_index

Review Comment:
   I think I can manage to do the vectorization, but it seems the table() can 
only be done using value not 0. If I try use (index,seq(1, nrow(X)) with index 
containing 0 it will return an error, but I think provided with my previous 
code of locating the missing rows and multiplying with A to get the new mask is 
possible.  



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to