You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemds.apache.org by ss...@apache.org on 2021/07/05 14:58:57 UTC

[systemds] branch master updated: [MINOR] Indexing fix in cvlm

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 31b65c5  [MINOR] Indexing fix in cvlm
31b65c5 is described below

commit 31b65c5f4301e6e9db751a45ea89821cb99b064f
Author: Shafaq Siddiqi <sh...@tugraz.at>
AuthorDate: Mon Jul 5 16:57:25 2021 +0200

    [MINOR] Indexing fix in cvlm
---
 scripts/builtin/cvlm.dml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/builtin/cvlm.dml b/scripts/builtin/cvlm.dml
index f607e74..6604456 100644
--- a/scripts/builtin/cvlm.dml
+++ b/scripts/builtin/cvlm.dml
@@ -22,7 +22,7 @@
 m_cvlm = function(Matrix[Double] X, Matrix[Double] y, Integer k, Integer icpt = 0, Double reg = 1e-7) return (Matrix[Double] y_predict, Matrix[Double] allbeta) 
 {
   M = nrow(X);
-  lim = as.integer(M/k);
+  lim = floor(as.integer(M/k));
   y_predict = y;
   allbeta = matrix(0, rows=k, cols=ncol(X));
 
@@ -36,6 +36,11 @@ m_cvlm = function(Matrix[Double] X, Matrix[Double] y, Integer k, Integer icpt =
       trainSet = X[testE+1:M,];
       trainRes = y[testE+1:M,];
     }
+    else if(i == k)
+    {
+      trainSet = X[1:testS-1,];
+      trainRes = y[1:testS-1,];
+    }
     else {
       trainSet = rbind(X[1:testS-1,], X[testE+1:M,]);
       trainRes = rbind(y[1:testS-1,], y[testE+1:M,]);