systemml-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berthold Reinwald" <reinw...@us.ibm.com>
Subject Re: which() Function in SystemML
Date Sat, 07 Jul 2018 00:12:27 GMT
You may also look at example 2 "Replace NaN with mode" in our "DML Tips 
and Tricks" examples notebook. Will add a which() example shortly.

https://github.com/apache/systemml/raw/master/samples/jupyter-notebooks/DML%20Tips%20and%20Tricks%20(aka%20Fun%20With%20DML).ipynb


Regards,
Berthold Reinwald
IBM Almaden Research Center
office: (408) 927 2208; T/L: 457 2208
e-mail: reinwald@us.ibm.com



From:   "Niketan Pansare" <npansar@us.ibm.com>
To:     dev@systemml.apache.org
Date:   07/05/2018 10:26 AM
Subject:        Re: which() Function in SystemML



Hi Kuno,

Thanks for trying out SystemML. One way to implement your logic in 
SystemML is as follows:
X = matrix("1 4 -99 2 5 -99", rows=6, cols=1)
Y = removeEmpty(target=(X > 2)*seq(1, nrow(X)), margin="rows")
print("\nIndexes:\n" + toString(Y))

For handling NAs, you can replace NAs by certain value (in this case -99 
or one of the builtin constants, i.e. Inf or NaN ... see 
https://github.com/apache/systemml/blob/master/src/test/scripts/org/apache/sysml/api/mlcontext/builtin-constants-test.dml
) using the "na.strings" parameter of the transform builtin function (
http://apache.github.io/systemml/dml-language-reference.html#transforming-frames
). 

Hope this helps.

Regards,

Niketan Pansare
IBM Almaden Research Center
E-mail: npansar At us.ibm.com
http://researcher.watson.ibm.com/researcher/view.php?person=us-npansar

"Baeriswyl Kuno (IT-SWE-CC1-JV6)" ---07/05/2018 05:29:53 AM---Hello, I'm a 
developer want to use SystemMl for running R-Code from our business people 
on a Spark c

From: "Baeriswyl Kuno (IT-SWE-CC1-JV6)" <kuno.baeriswyl@sbb.ch>
To: "dev@systemml.apache.org" <dev@systemml.apache.org>
Date: 07/05/2018 05:29 AM
Subject: which() Function in SystemML



Hello,

I'm a developer want to use SystemMl for running R-Code from our business 
people on a Spark cluster.

I've studied http://apache.github.io/systemml/dml-language-reference , 
however, haven't found a implementation of the R function "which" or any 
alternative functionality. Has anyone an idea how I could

# Given
v = c(1,4,NA,2, 5, NA)

# Expect indexes where value meets condition =  int[] 2 5
v2 = which(v>2)

# Expect indexes where is.na returns TRUE =   int[] 3 6
v3 = which(is.na(v))

I've already considered the functions replace() and removeEmpty(), but 
they don't exactly meets my needs.

Thanks a lot in advance
Kuno







Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message