This is an automated email from the ASF dual-hosted git repository.

mboehm7 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/main by this push:
     new a973b11075 [SYSTEMDS-3696] Fix edge cases incremental sliceline
a973b11075 is described below

commit a973b1107567cca27a4c23ec3e230e17f00f46e7
Author: Frederic Zoepffel <f.zoepf...@gmail.com>
AuthorDate: Fri Sep 13 09:25:59 2024 +0200

    [SYSTEMDS-3696] Fix edge cases incremental sliceline
    
    Closes #2106.
---
 scripts/builtin/incSliceLine.dml | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/scripts/builtin/incSliceLine.dml b/scripts/builtin/incSliceLine.dml
index f00b3d89db..0ef77bd5f2 100644
--- a/scripts/builtin/incSliceLine.dml
+++ b/scripts/builtin/incSliceLine.dml
@@ -220,14 +220,6 @@ m_incSliceLine = function(
     S = getPairedCandidatesInc(S, R, TKC, level, eAvg, minSup, alpha, n2, 
foffb, foffe);
     S2 = S;
 
-    # prepare and store output lattice for next run
-    Lrep = S
-    if ( encodeLat ) {
-      [Lrep, M] = transformSlicesToIDs(S, foffb, foffe);
-      metaLattice = append(metaLattice, M);
-    }
-    L = append(L, Lrep);
-
     # load one hot encoded previous lattice for the current level
     prevLattice2 = matrix(0,0,0);
     if(!disableIncSizePruning){
@@ -256,6 +248,14 @@ m_incSliceLine = function(
       }
     }
 
+    # prepare and store output lattice for next run
+    Lrep = S
+    if ( encodeLat ) {
+      [Lrep, M] = transformSlicesToIDs(S, foffb, foffe);
+      metaLattice = append(metaLattice, M);
+    }
+    L = append(L, Lrep);
+
     if( nrow(S) > 0 ) {
       # extract and evaluate candidate slices
       if( tpEval ) { # task-parallel
@@ -559,11 +559,15 @@ oneHotEncodeUsingOffsets = function(Matrix[Double] A, 
Matrix[Double] foffb, Matr
       rix = removeEmpty(target=rix, margin="rows", select=ix);
       cix = removeEmpty(target=cix, margin="rows", select=ix);
     }
-    # actual one-hot encoding
-    A2 = table(rix, cix, 1, m, as.scalar(foffe[,n]), FALSE);
-  }
-  else {
-    A2 = matrix(0, 0, as.scalar(foffe[,n]));
+
+    if (sum(rix) == 0 | sum(cix) == 0) {
+      A2 = matrix(0, 0, as.scalar(foffe[, n]));
+    } else {
+      # actual one-hot encoding
+      A2 = table(rix, cix, 1, m, as.scalar(foffe[, n]), FALSE);
+    }
+  } else {
+    A2 = matrix(0, 0, as.scalar(foffe[, n]));
   }
 }
 

Reply via email to