5 Starting from the version 3.0 Shogun uses CMake to facilitate
6 the building process. When
using command line on Linux- and Unix-based
7 systems with the `make` being available the building steps are:
9 1. go to the shogun repository root
11 3.
do `cmake [options] ..` (or `ccmake ..`
if available). It is very
12 recommended to use any of CMake GUIs (such as ccmake)
if you feel unsure
13 about possible parameters and configurations.
14 4.
do `make` (and `sudo make install`
if needed)
16 In
case you want to generate some IDE project (e.g. Eclipse CDT4 project)
17 use the `-G generator-name` key. You may obtain possible generators with
18 the `cmake --help` command. For example to generate Eclipse CDT4 project
19 for Shogun use the `cmake -G
"Eclipse CDT4 - Unix Makefiles"`.
21 Sometimes you would need to clean up your build (e.g. in
case of some major
22 changes). The easiest way to
do that is straightforward:
23 just
remove the `build` directory you created before.
25 If you prefer to not run the `make install` command, you should
26 instead include the shogun library in your path:
28 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:path_to_shogun/src/shogun/
30 Often you are just interested in one language and we always recommend to
31 use the more powerful modular interfaces.
35 To enable Multiple Kernel Learning with CPLEX(tm) just make sure cplex can
36 be found in the PATH. If it is not found shogun will resort to GLPK (if found)
37 for 1-
norm MKL, p-
norm MKL with p>1 will work nonetheless.
41 The standard linux utils like bash, grep, test, sed, cut, awk, ldd, uname gcc
42 g++ and cat, python (debian package: python2.7) are required
43 for the cmake to work.
45 To compile the R
interface you need to have the R developer files
46 (debian package r-
base-dev) installed.
48 To compile the octave
interface you need to have the octave developer files
49 (debian package liboctave-dev) installed.
51 To compile the java
interface you need to have the java developer files
52 (debian package openjdk-6-jdk or openjdk-7-jdk) and jblas (debian package
55 To compile the python
interface you need to have the python developer files
56 installed (debian packages python2.7-dev or python3.X-dev) and numpy
57 version 1.x installed (debian package python-numpy) installed.
59 Optionally you will need atlas, lapack and eigen3 (debian packages lapack3-dev,
60 atlas3-headers atlas3-
base-dev, libeigen3-dev) installed. Note that
61 atlas/lapack is only supported under linux and osx (high performance computing
62 should be done under linux only anyway). In case atlas/lapack is unavailable,
63 don't worry most of shogun will work without, though slightly slower versions
64 are used. For standard 1-
norm multiple kernel learning (MKL) the GNU Linear
65 Programming Kit (GLPK) version at least 4.29 or CPLEX is required. If you want
66 to build the html documentation or python online help you will need doxygen
67 version 1.6.0 or higher.
69 For the interfaces to compile you will need swig.
72 ##SPECIFIC BUILD INSTRUCTIONS FOR MODULAR INTERFACES
76 $ mkdir build && cd build
77 $ cmake -DPythonModular=ON ..
81 to test if it is working try
83 $ export LD_LIBRARY_PATH=SHOGUN_INSTALL_DIR/lib
84 $ export PYTHONPATH=SHOGUN_INSTALL_DIR/lib/pythonX.Y/dist-packages/
85 $ python examples/undocumented/python_modular/graphical/svm.py
87 ###object oriented octave/swig interface:
88 do all of the above you did for octave but now in addition install the swig
89 package and configure+compile shogun with:
91 $ mkdir build && cd build
92 $ cmake -DOctaveModular=ON ..
96 to test if it is working try octave examples/documented/octave_modular/libsvm.m
98 ###object oriented r/swig interface:
99 note that this
interface is pre-alpha quality
101 $ mkdir build && cd build
102 $ cmake -DRModular=ON ..
106 to test if it is working try R examples/documented/r_modular/all_classifier.R
108 ###object oriented java/swig interface:
110 $ mkdir build && cd build
111 $ cmake -DJavaModular=ON ..
115 to test if it is working try
117 $ export CLASSPATH=/usr/share/java/jblas.jar:SHOGUNDIR/src/java_modular/shogun.jar:.
118 $ export LD_LIBRARY_PATH=SHOGUNDIR/src/shogun:SHOGUNDIR/src/java_modular
119 $ javac ../examples/udocumented/java_modular/classifier_libsvm_minimal_modular.java
120 $ java classifier_libsvm_minimal_modular
122 ##SPECIFIC BUILD INSTRUCTIONS FOR LEGACY STATIC INTERFACES
126 $ mkdir build && cd build
127 $ cmake -DCmdLineStatic=ON ..
130 a shogun executable can be found in interfaces/cmdline_static
132 In order to test the shogun standalone binary, you can run the following
133 commands from the project root directory:
135 $ cd examples/documented/cmdline_static
136 $ ../../../src/interfaces/cmdline_static/shogun classifier_liblinear.sg
139 To compile the octave
interface you need to have the octave developer files
140 (debian package liboctave-dev).
144 $ mkdir build && cd build
145 $ cmake -DOctaveStatic=ON ..
149 a sg.oct file should be created. as a test start octave in the
150 examples/documented/octave_static/ directory and type
152 addpath('../../../src/interfaces/octave_static/graphical')
156 To compile the matlab
interface you need to have matlab installed in the path
157 (i.e., typing matlab in the shell should start matlab).
161 $ mkdir build && cd build
162 $ cmake -DMatlabStatic=ON ..
166 a sg.mexglx (or sg.mexa64 or sg.mexmac etc file should be created in
167 src/interfaces/matlab_static/). As a test start matlab in the
168 examples/documented/matlab_static directory and type
170 addpath('../../../src/interfaces/matlab_static/graphical')
173 For permanent use you could add the following line to your matlab/startup.m
175 addpath('path_to_shogun/src/interfaces/matlab_static');
178 To compile the R
interface you need to have the R developer files
179 (debian package r-base-dev) installed.
183 $ mkdir build && cd build
184 $ cmake -DRStatic=ON ..
189 To compile the python
interface you need to have numpy version 1.x installed
190 (debian package python-numpy) and optionally for plotting
191 python-matplotlib installed.
193 $ mkdir build && cd build
194 $ cmake -DPythonStatic=ON ..
198 A sg.so file should be created in the src/interfaces/python_static directory:
199 To test whether it is working change to examples/documented/python_static/graphical
202 $ PYTHONPATH=path_to_shogun/src/interfaces/python_static/ python svm_classification.py
204 ###eierlegendewollmichsau (elwms) interface
205 This is a .so file that works with R,python,matlab,octave all in one. To compile
206 you should have at least python and some other
interface enabled:
208 $ mkdir build && cd build
209 $ cmake -DElwmsStatic=ON ..
213 $ cd src/interfaces/elwms_static
214 $ LD_LIBRARY_PATH=/path/to/octave/lib:/path/to/matlab/libs octave
217 examples/documented/{r_static,python_static,matlab_static,octave_static}
double norm(double *v, double p, int n)