Created
February 17, 2018 18:23
-
-
Save chamathabeysinghe/8f338700cea6feac5a1c724770aa99a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ml = MLContext(spark) | |
matrixScript = dml( | |
""" | |
fileM = 'test_csv.csv' | |
numRowsToPrint = ifdef($rowsToPrint, 2) # default to 2 | |
numColsToPrint = ifdef($colsToPrint, 2) # default to 2 | |
m = read(fileM) | |
for (i in 1:numRowsToPrint) { | |
for (j in 1:numColsToPrint) { | |
print('[' + i + ',' + j + ']:' + as.scalar(m[i,j])) | |
} | |
} | |
""" | |
) | |
ml.execute(matrixScript) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment