SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Eierlegendewollmilchsau Interface

As mentioned before SHOGUN interfaces to several programming languages and toolkits such as Matlab(tm), R, Python, Octave. The special Eierlegendewollmilchsau (elwms) interface does everything in one file. It is a chimera of all the Static Interfaces, thus all the examples and documentation form Static Interfaces still apply.

One of the key strengths of this interface is that it provides the

elwms('run_python', 'A', A, ..., pythoncode, '...')
elwms('run_r', 'A', A, ..., 'rfile', '...')
elwms('run_octave', 'A', A, ..., octavecode, '...')

interoperability commands that enable running of code in foreign languages. For example

% uses matplotlib to plot a figure from within octave

A=[[1,2,3];[4,5,6]];
B=[[1,1,1];[0,0,0]];
pythoncode=sprintf("\
\
import numpy\n\
x=numpy.array([[1.0,2,3],[4,5,6]])\n\
results=(A, B, [ 'bla1', 'bla2' ], x)\n\
\
from pylab import *\n\
plot(B)\n\
show()\n\
\
")

[A2,B2,bla,x]=elwms('run_python', 'A',A, 'B',B, 'pythoncode', pythoncode)
sprintf('%s\n', char(bla{1}))
sprintf('%s\n', char(bla{2}))

allows us to use matplotlib to plot figures from within octave! All the types that shogun supports when translating variables between languages. In this case two floating point matrices A and B are passed to python and they are passed back from python unchanged together with a list of strings and another variable x. Note that the it uses elwms instead of sg as function name.

In addition it is suggested to have a look at the examples/elwms directory for additional commands elwms provides.


SHOGUN Machine Learning Toolbox - Documentation