You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@systemds.apache.org by "regaleo605 (via GitHub)" <gi...@apache.org> on 2023/08/26 08:10:03 UTC

[GitHub] [systemds] regaleo605 commented on a diff in pull request #1888: [SYSTEMDS-3153] Imputation for all missing columns and seed handling

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: dev-unsubscribe@systemds.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org