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 afe7077ee1 [MINOR] Robustness random forest for very small sampling 
fractions
afe7077ee1 is described below

commit afe7077ee1fa91d47aee6c985125f56ea80f8f32
Author: Matthias Boehm <[email protected]>
AuthorDate: Fri Oct 27 21:40:23 2023 +0200

    [MINOR] Robustness random forest for very small sampling fractions
---
 scripts/builtin/randomForest.dml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/builtin/randomForest.dml b/scripts/builtin/randomForest.dml
index ccebd59d86..8daeb5bc7f 100644
--- a/scripts/builtin/randomForest.dml
+++ b/scripts/builtin/randomForest.dml
@@ -110,6 +110,8 @@ m_randomForest = function(Matrix[Double] X, Matrix[Double] 
y, Matrix[Double] cty
     if( sample_frac < 1.0 ) {
       si1 = as.integer(as.scalar(randSeeds[3*(i-1)+1,1]));
       I1 = rand(rows=nrow(X), cols=1, seed=si1) <= sample_frac;
+      if( sum(I1) <= 1 ) # min 2 tuples
+        I1[1:2,] = matrix(1,2,1);
       Xi = removeEmpty(target=X, margin="rows", select=I1);
       yi = removeEmpty(target=y, margin="rows", select=I1);
     }

Reply via email to