1.6 introduces new model runner: Octave. This allows execution of Matlab models within FastScore as long as toolboxes and statements used are supported by Octave.
A few rules to conform when creating Matlab model to run in FastScore:
function f = begin() global Data Data = csvread("data.csv"); f = 0;
The above code should be placed into begin.m, packaged along with data.csv and uploaded to your model:
$ tar czf model_att.tar.gz begin.m data.csv # assuming that MatlabCalc already exists $ fastscore attachment upload MatlabCalc model_att.tar.gz
FastScore will detect the presence of begin.m file and will run prior to executing the MatlabCalc model, but in the same Octave session making global data accessible by the model.
Octave runner only supports JSON encoding for input/output streams.
Malab / Octave code is optimized to work with matrix data. As such, it will be often required to pass a matrix as model input. The following simple example shows how to implement Eigen vector calculation with FastScore leveraging Octave runner.
function EV = eigen(A) % Calculate eigen values EV = eig(A)
$ fastscore model add eigen eigen.m $ fastscore model list Name Type --------- ------ eigen Octave
[[1, 7, 3], [2, 9, 12], [5, 22, 7]] [[2, 13, 5], [2, 9, 12], [5, 44, 7]]
[[25.554838634290714], [-0.5789337929080558], [-7.975904841382665]] [[32.694332616156586], [0.23962844553789128], [-14.933961061694498]]