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
$ redis-cli --eval train-kmeans-with-dependencies.lua 0,0 | |
$ tail /usr/local/var/log/redis.log | |
22385:M 23 Feb 2019 12:48:23.898 - Accepted 127.0.0.1:49901 | |
INFO Running Stuart (Embedded Spark 2.2.0) | |
INFO Local KMeans++ reached the max number of iterations: 30 | |
INFO Local KMeans++ reached the max number of iterations: 30 | |
INFO KMeans converged in 4 iterations. | |
INFO The cost is 320.460000 |
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
$ redis-cli --eval test1-with-dependencies.lua 0,0 | |
"5,6,7,8,9,10,11" |
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
$ amalg-redis.lua -s test1.lua -o test1-with-dependencies.lua -c | |
$ wc -l test1-with-dependencies.lua | |
2913 test1-with-dependencies.lua |
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
$ lua -lamalg-redis test1.lua | |
5,6,7,8,9,10,11 | |
$ cat amalg.cache | |
return { | |
[ "moses" ] = "L", | |
} |
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
local moses = require 'moses' | |
local acc = {} | |
for _, i in ipairs(moses.range(5,11)) do | |
acc[#acc+1] = i | |
end | |
local result = table.concat(acc, ',') | |
print(result) | |
return result |
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
$ luarocks install amalg-redis |
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
print(collectgarbage('count')) | |
5.30859375 | |
Matrices = require 'stuart-ml.linalg.Matrices' | |
local dm = Matrices.dense(3, 2, {1.0, 3.0, 5.0, 2.0, 4.0, 6.0}) | |
print(collectgarbage('count')) | |
6.177734375 |
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
eLua# lua /rom/test/ml/Matrices.luo | |
Press CTRL+Z to exit Lua | |
Begin test | |
✓ dense matrix construction | |
✓ dense matrix construction with wrong dimension | |
✓ sparse matrix construction | |
✓ sparse matrix construction with wrong number of elements | |
✓ index in matrices incorrect input | |
✓ matrix indexing and updating | |
✓ toSparse, toDense |
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
<html> | |
<body> | |
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/fengari-web.js"></script> | |
<script type="application/lua" src="https://cdn.jsdelivr.net/npm/[email protected]/stuart.lua"></script> | |
<script type="application/lua" src="https://cdn.jsdelivr.net/npm/[email protected]/stuart-ml.lua"></script> | |
<script type="application/lua"> | |
local Matrices = require 'stuart-ml.linalg.Matrices' | |
local denseMatrix = Matrices.dense(3, 2, {1.0, 3.0, 5.0, 2.0, 4.0, 6.0}) | |
... |
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
Matrices = require 'stuart-ml.linalg.Matrices' | |
-- Create a dense matrix ((1.0, 2.0), (3.0, 4.0), (5.0, 6.0)) | |
local dm = Matrices.dense(3, 2, {1.0, 3.0, 5.0, 2.0, 4.0, 6.0}) | |
-- Create a sparse matrix ((9.0, 0.0), (0.0, 8.0), (0.0, 6.0)) | |
local sm = Matrices.sparse(3, 2, {0, 1, 3}, {0, 2, 1}, {9, 6, 8}) |
NewerOlder