Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.learn.libsvm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.learn.libsvm
Commits
6cc01259
Commit
6cc01259
authored
May 26, 2014
by
André Anjos
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xbob -> bob
parent
b87776ef
Changes
36
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
382 additions
and
208 deletions
+382
-208
.travis.yml
.travis.yml
+2
-2
MANIFEST.in
MANIFEST.in
+2
-2
README.rst
README.rst
+17
-17
bob/__init__.py
bob/__init__.py
+0
-0
bob/learn/__init__.py
bob/learn/__init__.py
+0
-0
bob/learn/libsvm/__init__.py
bob/learn/libsvm/__init__.py
+0
-0
bob/learn/libsvm/data/heart.out
bob/learn/libsvm/data/heart.out
+0
-0
bob/learn/libsvm/data/heart.svmdata
bob/learn/libsvm/data/heart.svmdata
+0
-0
bob/learn/libsvm/data/heart.svmmodel
bob/learn/libsvm/data/heart.svmmodel
+0
-0
bob/learn/libsvm/data/heart_no_probs.svmmodel
bob/learn/libsvm/data/heart_no_probs.svmmodel
+0
-0
bob/learn/libsvm/data/iris.out
bob/learn/libsvm/data/iris.out
+0
-0
bob/learn/libsvm/data/iris.svmdata
bob/learn/libsvm/data/iris.svmdata
+0
-0
bob/learn/libsvm/data/iris.svmmodel
bob/learn/libsvm/data/iris.svmmodel
+0
-0
bob/learn/libsvm/file.cpp
bob/learn/libsvm/file.cpp
+1
-1
bob/learn/libsvm/include/bob.learn.libsvm/api.h
bob/learn/libsvm/include/bob.learn.libsvm/api.h
+59
-59
bob/learn/libsvm/include/bob.learn.libsvm/config.h
bob/learn/libsvm/include/bob.learn.libsvm/config.h
+14
-0
bob/learn/libsvm/include/bob.learn.libsvm/file.h
bob/learn/libsvm/include/bob.learn.libsvm/file.h
+0
-0
bob/learn/libsvm/include/bob.learn.libsvm/machine.h
bob/learn/libsvm/include/bob.learn.libsvm/machine.h
+0
-0
bob/learn/libsvm/include/bob.learn.libsvm/trainer.h
bob/learn/libsvm/include/bob.learn.libsvm/trainer.h
+0
-0
bob/learn/libsvm/machine.cpp
bob/learn/libsvm/machine.cpp
+1
-1
bob/learn/libsvm/main.cpp
bob/learn/libsvm/main.cpp
+160
-0
bob/learn/libsvm/pyfile.cpp
bob/learn/libsvm/pyfile.cpp
+8
-8
bob/learn/libsvm/pymachine.cpp
bob/learn/libsvm/pymachine.cpp
+11
-11
bob/learn/libsvm/pytrainer.cpp
bob/learn/libsvm/pytrainer.cpp
+9
-9
bob/learn/libsvm/pyutils.cpp
bob/learn/libsvm/pyutils.cpp
+3
-3
bob/learn/libsvm/test_machine.py
bob/learn/libsvm/test_machine.py
+3
-3
bob/learn/libsvm/test_trainer.py
bob/learn/libsvm/test_trainer.py
+0
-0
bob/learn/libsvm/trainer.cpp
bob/learn/libsvm/trainer.cpp
+1
-1
bob/learn/libsvm/version.cpp
bob/learn/libsvm/version.cpp
+19
-19
buildout.cfg
buildout.cfg
+10
-10
doc/c_cpp_api.rst
doc/c_cpp_api.rst
+11
-11
doc/conf.py
doc/conf.py
+6
-6
doc/doxygen.rc
doc/doxygen.rc
+2
-2
doc/guide.rst
doc/guide.rst
+15
-15
doc/py_api.rst
doc/py_api.rst
+2
-2
setup.py
setup.py
+26
-26
No files found.
.travis.yml
View file @
6cc01259
...
...
@@ -26,8 +26,8 @@ install:
-
"
python
bootstrap.py"
-
"
CFLAGS=-coverage
./bin/buildout"
script
:
-
"
./bin/python
-c
'from
x
bob.learn.libsvm
import
get_config;
print(get_config())'"
-
"
./bin/coverage
run
--source=
x
bob.learn.libsvm
./bin/nosetests
-sv"
-
"
./bin/python
-c
'from
bob.learn.libsvm
import
get_config;
print(get_config())'"
-
"
./bin/coverage
run
--source=bob.learn.libsvm
./bin/nosetests
-sv"
-
"
./bin/sphinx-build
-b
doctest
doc
sphinx"
-
"
./bin/sphinx-build
-b
html
doc
sphinx"
after_success
:
...
...
MANIFEST.in
View file @
6cc01259
include LICENSE README.rst bootstrap.py buildout.cfg
recursive-include doc conf.py doxygen.rc *.rst
recursive-include
x
bob/learn/libsvm *.cpp *.h
recursive-include
x
bob/learn/libsvm/data *.*
recursive-include bob/learn/libsvm *.cpp *.h
recursive-include bob/learn/libsvm/data *.*
README.rst
View file @
6cc01259
...
...
@@ -2,16 +2,16 @@
.. Andre Anjos <andre.anjos@idiap.ch>
.. Fri 13 Dec 2013 12:35:22 CET
.. image:: https://travis-ci.org/bioidiap/
x
bob.learn.libsvm.svg?branch=master
:target: https://travis-ci.org/bioidiap/
x
bob.learn.libsvm
.. image:: https://coveralls.io/repos/bioidiap/
x
bob.learn.libsvm/badge.png
:target: https://coveralls.io/r/bioidiap/
x
bob.learn.libsvm
.. image:: http://img.shields.io/github/tag/bioidiap/
x
bob.learn.libsvm.png
:target: https://github.com/bioidiap/
x
bob.learn.libsvm
.. image:: http://img.shields.io/pypi/v/
x
bob.learn.libsvm.png
:target: https://pypi.python.org/pypi/
x
bob.learn.libsvm
.. image:: http://img.shields.io/pypi/dm/
x
bob.learn.libsvm.png
:target: https://pypi.python.org/pypi/
x
bob.learn.libsvm
.. image:: https://travis-ci.org/bioidiap/bob.learn.libsvm.svg?branch=master
:target: https://travis-ci.org/bioidiap/bob.learn.libsvm
.. image:: https://coveralls.io/repos/bioidiap/bob.learn.libsvm/badge.png
:target: https://coveralls.io/r/bioidiap/bob.learn.libsvm
.. image:: http://img.shields.io/github/tag/bioidiap/bob.learn.libsvm.png
:target: https://github.com/bioidiap/bob.learn.libsvm
.. image:: http://img.shields.io/pypi/v/bob.learn.libsvm.png
:target: https://pypi.python.org/pypi/bob.learn.libsvm
.. image:: http://img.shields.io/pypi/dm/bob.learn.libsvm.png
:target: https://pypi.python.org/pypi/bob.learn.libsvm
================================
Bob-Python bindings for LIBSVM
...
...
@@ -28,8 +28,8 @@ automatically. You can just skip to the installation instructions.
In case you have installed ``LIBSVM`` on a non-standard location (e.g. your
home directory), then you can specify the path to the root of that installation
using the environment variable ``
X
BOB_PREFIX_PATH``, **before** building and
installing the package. For example, if ``
X
BOB_PREFIX_PATH`` is set to
using the environment variable ``BOB_PREFIX_PATH``, **before** building and
installing the package. For example, if ``BOB_PREFIX_PATH`` is set to
``/home/user/libsvm-3.12``, then we will search for the header file ``svm.h``
in ``/home/user/libsvm-3.12/include`` and expect that the library file file is
found under ``/home/user/libsvm-3.12/lib``.
...
...
@@ -37,11 +37,11 @@ found under ``/home/user/libsvm-3.12/lib``.
If you are installing this package via ``pip`` for example, just set the
environment variable like this::
$
XBOB_PREFIX_PATH=/home/user/libsvm-3.12 pip install x
bob.learn.libsvm
$
BOB_PREFIX_PATH=/home/user/libsvm-3.12 pip install
bob.learn.libsvm
If you are installing this package via ``zc.buildout``, we recommend you use
our `
xbob.buildout <http://pypi.python.org/pypi/x
bob.buildout>`_ extension and
set the ``[environ]`` section to define ``
X
BOB_PREFIX_PATH``.
our `
bob.buildout <http://pypi.python.org/pypi/
bob.buildout>`_ extension and
set the ``[environ]`` section to define ``BOB_PREFIX_PATH``.
Installation
------------
...
...
@@ -65,7 +65,7 @@ Testing
You can run a set of tests using the nose test runner::
$ nosetests -sv
x
bob.learn.libsvm
$ nosetests -sv bob.learn.libsvm
.. warning::
...
...
@@ -82,7 +82,7 @@ You can run our documentation tests using sphinx itself::
You can test overall test coverage with::
$ nosetests --with-coverage --cover-package=
x
bob.learn.libsvm
$ nosetests --with-coverage --cover-package=bob.learn.libsvm
The ``coverage`` egg must be installed for this to work properly.
...
...
x
bob/__init__.py
→
bob/__init__.py
View file @
6cc01259
File moved
x
bob/learn/__init__.py
→
bob/learn/__init__.py
View file @
6cc01259
File moved
x
bob/learn/libsvm/__init__.py
→
bob/learn/libsvm/__init__.py
View file @
6cc01259
File moved
x
bob/learn/libsvm/data/heart.out
→
bob/learn/libsvm/data/heart.out
View file @
6cc01259
File moved
x
bob/learn/libsvm/data/heart.svmdata
→
bob/learn/libsvm/data/heart.svmdata
View file @
6cc01259
File moved
x
bob/learn/libsvm/data/heart.svmmodel
→
bob/learn/libsvm/data/heart.svmmodel
View file @
6cc01259
File moved
x
bob/learn/libsvm/data/heart_no_probs.svmmodel
→
bob/learn/libsvm/data/heart_no_probs.svmmodel
View file @
6cc01259
File moved
x
bob/learn/libsvm/data/iris.out
→
bob/learn/libsvm/data/iris.out
View file @
6cc01259
File moved
x
bob/learn/libsvm/data/iris.svmdata
→
bob/learn/libsvm/data/iris.svmdata
View file @
6cc01259
File moved
x
bob/learn/libsvm/data/iris.svmmodel
→
bob/learn/libsvm/data/iris.svmmodel
View file @
6cc01259
File moved
x
bob/learn/libsvm/file.cpp
→
bob/learn/libsvm/file.cpp
View file @
6cc01259
...
...
@@ -7,7 +7,7 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#include <
x
bob.learn.libsvm/file.h>
#include <bob.learn.libsvm/file.h>
#include <boost/format.hpp>
#include <boost/algorithm/string.hpp>
...
...
xbob/learn/libsvm/include/x
bob.learn.libsvm/api.h
→
bob/learn/libsvm/include/
bob.learn.libsvm/api.h
View file @
6cc01259
This diff is collapsed.
Click to expand it.
xbob/learn/libsvm/include/x
bob.learn.libsvm/config.h
→
bob/learn/libsvm/include/
bob.learn.libsvm/config.h
View file @
6cc01259
...
...
@@ -2,13 +2,13 @@
* @author Andre Anjos <andre.anjos@idiap.ch>
* @date Tue 25 Mar 2014 12:57:21 CET
*
* @brief General directives for all modules in
x
bob.learn.libsvm
* @brief General directives for all modules in bob.learn.libsvm
*/
#ifndef
X
BOB_LEARN_LIBSVM_CONFIG_H
#define
X
BOB_LEARN_LIBSVM_CONFIG_H
#ifndef BOB_LEARN_LIBSVM_CONFIG_H
#define BOB_LEARN_LIBSVM_CONFIG_H
/* Macros that define versions and important names */
#define
X
BOB_LEARN_LIBSVM_API_VERSION 0x0200
#define BOB_LEARN_LIBSVM_API_VERSION 0x0200
#endif
/*
X
BOB_LEARN_LIBSVM_CONFIG_H */
#endif
/* BOB_LEARN_LIBSVM_CONFIG_H */
xbob/learn/libsvm/include/x
bob.learn.libsvm/file.h
→
bob/learn/libsvm/include/
bob.learn.libsvm/file.h
View file @
6cc01259
File moved
xbob/learn/libsvm/include/x
bob.learn.libsvm/machine.h
→
bob/learn/libsvm/include/
bob.learn.libsvm/machine.h
View file @
6cc01259
File moved
xbob/learn/libsvm/include/x
bob.learn.libsvm/trainer.h
→
bob/learn/libsvm/include/
bob.learn.libsvm/trainer.h
View file @
6cc01259
File moved
x
bob/learn/libsvm/machine.cpp
→
bob/learn/libsvm/machine.cpp
View file @
6cc01259
...
...
@@ -7,7 +7,7 @@
* Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
*/
#include <
x
bob.learn.libsvm/machine.h>
#include <bob.learn.libsvm/machine.h>
#include <sys/stat.h>
#include <boost/format.hpp>
...
...
x
bob/learn/libsvm/main.cpp
→
bob/learn/libsvm/main.cpp
View file @
6cc01259
...
...
@@ -5,15 +5,15 @@
* @brief Bindings to bob::machine
*/
#define
X
BOB_LEARN_LIBSVM_MODULE
#include <
x
bob.learn.libsvm/api.h>
#define BOB_LEARN_LIBSVM_MODULE
#include <bob.learn.libsvm/api.h>
#ifdef NO_IMPORT_ARRAY
#undef NO_IMPORT_ARRAY
#endif
#include <
x
bob.blitz/capi.h>
#include <
x
bob.blitz/cleanup.h>
#include <
x
bob.io.base/api.h>
#include <bob.blitz/capi.h>
#include <bob.blitz/cleanup.h>
#include <bob.io.base/api.h>
static
PyMethodDef
module_methods
[]
=
{
{
0
}
/* Sentinel */
...
...
@@ -21,12 +21,12 @@ static PyMethodDef module_methods[] = {
PyDoc_STRVAR
(
module_docstr
,
"bob::learn::libsvm's machine and trainers"
);
int
Py
XbobLearnLibsvm_APIVersion
=
X
BOB_LEARN_LIBSVM_API_VERSION
;
int
Py
BobLearnLibsvm_APIVersion
=
BOB_LEARN_LIBSVM_API_VERSION
;
#if PY_VERSION_HEX >= 0x03000000
static
PyModuleDef
module_definition
=
{
PyModuleDef_HEAD_INIT
,
X
BOB_EXT_MODULE_NAME
,
BOB_EXT_MODULE_NAME
,
module_docstr
,
-
1
,
module_methods
,
...
...
@@ -48,14 +48,14 @@ static PyObject* create_module (void) {
# if PY_VERSION_HEX >= 0x03000000
PyObject
*
m
=
PyModule_Create
(
&
module_definition
);
# else
PyObject
*
m
=
Py_InitModule3
(
X
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
PyObject
*
m
=
Py_InitModule3
(
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
# endif
if
(
!
m
)
return
0
;
auto
m_
=
make_safe
(
m
);
/* register some constants */
if
(
PyModule_AddIntConstant
(
m
,
"__api_version__"
,
X
BOB_LEARN_LIBSVM_API_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddStringConstant
(
m
,
"__version__"
,
X
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddIntConstant
(
m
,
"__api_version__"
,
BOB_LEARN_LIBSVM_API_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddStringConstant
(
m
,
"__version__"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
/* register the types to python */
Py_INCREF
(
&
PyBobLearnLibsvmFile_Type
);
...
...
@@ -67,7 +67,7 @@ static PyObject* create_module (void) {
Py_INCREF
(
&
PyBobLearnLibsvmTrainer_Type
);
if
(
PyModule_AddObject
(
m
,
"Trainer"
,
(
PyObject
*
)
&
PyBobLearnLibsvmTrainer_Type
)
<
0
)
return
0
;
static
void
*
Py
XbobLearnLibsvm_API
[
PyXb
obLearnLibsvm_API_pointers
];
static
void
*
Py
BobLearnLibsvm_API
[
PyB
obLearnLibsvm_API_pointers
];
/* exhaustive list of C APIs */
...
...
@@ -75,75 +75,75 @@ static PyObject* create_module (void) {
* Versioning *
**************/
Py
XbobLearnLibsvm_API
[
PyXbobLearnLibsvm_APIVersion_NUM
]
=
(
void
*
)
&
PyXb
obLearnLibsvm_APIVersion
;
Py
BobLearnLibsvm_API
[
PyBobLearnLibsvm_APIVersion_NUM
]
=
(
void
*
)
&
PyB
obLearnLibsvm_APIVersion
;
/***************************************
* Bindings for
x
bob.learn.libsvm.File *
* Bindings for bob.learn.libsvm.File *
***************************************/
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvmFile_Type_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmFile_Type
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvmFile_Type_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmFile_Type
;
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvmFile_Check_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmFile_Check
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvmFile_Check_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmFile_Check
;
/******************************************
* Bindings for
x
bob.learn.libsvm.Machine *
* Bindings for bob.learn.libsvm.Machine *
******************************************/
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvmMachine_Type_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmMachine_Type
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvmMachine_Type_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmMachine_Type
;
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvmMachine_Check_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmMachine_Check
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvmMachine_Check_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmMachine_Check
;
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvmMachine_NewFromMachine_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmMachine_NewFromMachine
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvmMachine_NewFromMachine_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmMachine_NewFromMachine
;
/******************************************
* Bindings for
x
bob.learn.libsvm.Trainer *
* Bindings for bob.learn.libsvm.Trainer *
******************************************/
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvmTrainer_Type_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmTrainer_Type
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvmTrainer_Type_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmTrainer_Type
;
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvmTrainer_Check_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmTrainer_Check
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvmTrainer_Check_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvmTrainer_Check
;
/*********************************
* Bindings to general utilities *
*********************************/
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvm_MachineTypeAsString_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_MachineTypeAsString
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvm_MachineTypeAsString_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_MachineTypeAsString
;
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvm_StringAsMachineType_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_StringAsMachineType
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvm_StringAsMachineType_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_StringAsMachineType
;
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvm_CStringAsMachineType_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_CStringAsMachineType
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvm_CStringAsMachineType_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_CStringAsMachineType
;
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvm_KernelTypeAsString_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_KernelTypeAsString
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvm_KernelTypeAsString_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_KernelTypeAsString
;
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvm_StringAsKernelType_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_StringAsKernelType
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvm_StringAsKernelType_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_StringAsKernelType
;
Py
Xb
obLearnLibsvm_API
[
PyBobLearnLibsvm_CStringAsKernelType_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_CStringAsKernelType
;
Py
B
obLearnLibsvm_API
[
PyBobLearnLibsvm_CStringAsKernelType_NUM
]
=
(
void
*
)
&
PyBobLearnLibsvm_CStringAsKernelType
;
#if PY_VERSION_HEX >= 0x02070000
/* defines the PyCapsule */
PyObject
*
c_api_object
=
PyCapsule_New
((
void
*
)
Py
Xb
obLearnLibsvm_API
,
XBOB_EXT_MODULE_PREFIX
"."
X
BOB_EXT_MODULE_NAME
"._C_API"
,
0
);
PyObject
*
c_api_object
=
PyCapsule_New
((
void
*
)
Py
B
obLearnLibsvm_API
,
BOB_EXT_MODULE_PREFIX
"."
BOB_EXT_MODULE_NAME
"._C_API"
,
0
);
#else
PyObject
*
c_api_object
=
PyCObject_FromVoidPtr
((
void
*
)
Py
Xb
obLearnLibsvm_API
,
0
);
PyObject
*
c_api_object
=
PyCObject_FromVoidPtr
((
void
*
)
Py
B
obLearnLibsvm_API
,
0
);
#endif
if
(
c_api_object
)
PyModule_AddObject
(
m
,
"_C_API"
,
c_api_object
);
/* imports dependencies */
if
(
import_
x
bob_blitz
()
<
0
)
{
if
(
import_bob_blitz
()
<
0
)
{
PyErr_Print
();
PyErr_Format
(
PyExc_ImportError
,
"cannot import `%s'"
,
X
BOB_EXT_MODULE_NAME
);
PyErr_Format
(
PyExc_ImportError
,
"cannot import `%s'"
,
BOB_EXT_MODULE_NAME
);
return
0
;
}
if
(
import_
x
bob_io_base
()
<
0
)
{
if
(
import_bob_io_base
()
<
0
)
{
PyErr_Print
();
PyErr_Format
(
PyExc_ImportError
,
"cannot import `%s'"
,
X
BOB_EXT_MODULE_NAME
);
PyErr_Format
(
PyExc_ImportError
,
"cannot import `%s'"
,
BOB_EXT_MODULE_NAME
);
return
0
;
}
...
...
@@ -152,7 +152,7 @@ static PyObject* create_module (void) {
}
PyMODINIT_FUNC
X
BOB_EXT_ENTRY_NAME
(
void
)
{
PyMODINIT_FUNC
BOB_EXT_ENTRY_NAME
(
void
)
{
# if PY_VERSION_HEX >= 0x03000000
return
# endif
...
...
x
bob/learn/libsvm/pyfile.cpp
→
bob/learn/libsvm/pyfile.cpp
View file @
6cc01259
...
...
@@ -7,18 +7,18 @@
* Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
*/
#define
X
BOB_LEARN_LIBSVM_MODULE
#include <
x
bob.blitz/cppapi.h>
#include <
x
bob.blitz/cleanup.h>
#include <
x
bob.io.base/api.h>
#include <
x
bob.learn.libsvm/api.h>
#define BOB_LEARN_LIBSVM_MODULE
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <bob.io.base/api.h>
#include <bob.learn.libsvm/api.h>
#include <structmember.h>
/***********************************************
* Implementation of Support Vector File class *
***********************************************/
PyDoc_STRVAR
(
s_file_str
,
X
BOB_EXT_MODULE_PREFIX
".File"
);
PyDoc_STRVAR
(
s_file_str
,
BOB_EXT_MODULE_PREFIX
".File"
);
PyDoc_STRVAR
(
s_file_doc
,
"File(path)
\n
\
...
...
@@ -159,7 +159,7 @@ PyObject* PyBobLearnLibsvmFile_Repr(PyBobLearnLibsvmFileObject* self) {
/**
* Expected output:
*
*
x
bob.learn.libsvm.File('filename')
* bob.learn.libsvm.File('filename')
*/
PyObject
*
retval
=
PyUnicode_FromFormat
(
"%s('%s')"
,
...
...
@@ -181,7 +181,7 @@ PyObject* PyBobLearnLibsvmFile_Str(PyBobLearnLibsvmFileObject* self) {
/**
* Expected output:
*
*
x
bob.learn.libsvm.File('filename') <float64@(3, 4)>
* bob.learn.libsvm.File('filename') <float64@(3, 4)>
*/
PyObject
*
retval
=
PyUnicode_FromFormat
(
"%s('%s') <float64@(%"
PY_FORMAT_SIZE_T
"d, %"
PY_FORMAT_SIZE_T
"d)>"
,
...
...
x
bob/learn/libsvm/pymachine.cpp
→
bob/learn/libsvm/pymachine.cpp
View file @
6cc01259
...
...
@@ -7,18 +7,18 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#define
X
BOB_LEARN_LIBSVM_MODULE
#include <
x
bob.blitz/cppapi.h>
#include <
x
bob.blitz/cleanup.h>
#include <
x
bob.io.base/api.h>
#include <
x
bob.learn.libsvm/api.h>
#define BOB_LEARN_LIBSVM_MODULE
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <bob.io.base/api.h>
#include <bob.learn.libsvm/api.h>
#include <structmember.h>
/*******************************************************
* Implementation of Support Vector Machine base class *
*******************************************************/
PyDoc_STRVAR
(
s_svm_str
,
X
BOB_EXT_MODULE_PREFIX
".Machine"
);
PyDoc_STRVAR
(
s_svm_str
,
BOB_EXT_MODULE_PREFIX
".Machine"
);
PyDoc_STRVAR
(
s_svm_doc
,
"Machine(path)
\n
\
...
...
@@ -59,7 +59,7 @@ state recovery from previous sessions.\n\
"
);
/***********************************************
* Implementation of
x
bob.learn.libsvm.Machine *
* Implementation of bob.learn.libsvm.Machine *
***********************************************/
static
int
PyBobLearnLibsvmMachine_init_svmfile
...
...
@@ -416,7 +416,7 @@ PyObject* PyBobLearnLibsvmMachine_Repr(PyBobLearnLibsvmMachineObject* self) {
/**
* Expected output:
*
* <
x
bob.learn.libsvm.Machine float64@(3, 2)>
* <bob.learn.libsvm.Machine float64@(3, 2)>
*/
auto
shape
=
make_safe
(
PyObject_GetAttrString
((
PyObject
*
)
self
,
"shape"
));
...
...
@@ -441,7 +441,7 @@ PyObject* PyBobLearnLibsvmMachine_Str(PyBobLearnLibsvmMachineObject* self) {
/**
* Expected output:
*
*
x
bob.learn.libsvm.Machine (float64) 3 inputs, 2 outputs
* bob.learn.libsvm.Machine (float64) 3 inputs, 2 outputs
* properties...
*
* TODO: Not fully implemented yet
...
...
@@ -932,8 +932,8 @@ PyDoc_STRVAR(s_save_doc,
o.save(hdf5file) -> None
\n
\
\n
\
Saves itself at a LIBSVM model file or into a
\n
\
:py:class:`
x
bob.io.HDF5File`. Saving the SVM into an
\n
\
:py:class:`
x
bob.io.HDF5File` object, has the advantage of saving
\n
\
:py:class:`bob.io.HDF5File`. Saving the SVM into an
\n
\
:py:class:`bob.io.HDF5File` object, has the advantage of saving
\n
\
input normalization options together with the machine, which are
\n
\
automatically reloaded when you re-initialize it from the same
\n
\
:py:class:`HDF5File`.
\n
\
...
...
x
bob/learn/libsvm/pytrainer.cpp
→
bob/learn/libsvm/pytrainer.cpp
View file @
6cc01259
...
...
@@ -7,18 +7,18 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#define
X
BOB_LEARN_LIBSVM_MODULE
#include <
x
bob.blitz/cppapi.h>
#include <
x
bob.blitz/cleanup.h>
#include <
x
bob.io.base/api.h>
#include <
x
bob.learn.libsvm/api.h>
#define BOB_LEARN_LIBSVM_MODULE
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <bob.io.base/api.h>
#include <bob.learn.libsvm/api.h>
#include <structmember.h>
/*******************************************************
* Implementation of Support Vector Trainer base class *
*******************************************************/
PyDoc_STRVAR
(
s_svm_str
,
X
BOB_EXT_MODULE_PREFIX
".Trainer"
);
PyDoc_STRVAR
(
s_svm_str
,
BOB_EXT_MODULE_PREFIX
".Trainer"
);
PyDoc_STRVAR
(
s_svm_doc
,
"Trainer([machine_type='C_SVC', [kernel_type='RBF', [cache_size=100, [stop_epsilon=1e-3, [shrinking=True, [probability=False]]]]]]) -> new Trainer
\n
\
...
...
@@ -81,7 +81,7 @@ probability, bool\n\
"
);
/***********************************************
* Implementation of
x
bob.learn.libsvm.Trainer *
* Implementation of bob.learn.libsvm.Trainer *
***********************************************/
static
int
PyBobLearnLibsvmTrainer_init
...
...
@@ -508,7 +508,7 @@ PyObject* PyBobLearnLibsvmTrainer_Repr(PyBobLearnLibsvmTrainerObject* self) {
/**
* Expected output:
*
* <
x
bob.learn.libsvm.Trainer>
* <bob.learn.libsvm.Trainer>
*
* @TODO: Improve this output
*/
...
...
@@ -531,7 +531,7 @@ PyObject* PyBobLearnLibsvmTrainer_Str(PyBobLearnLibsvmTrainerObject* self) {
/**
* Expected output:
*
*
x
bob.learn.libsvm.Trainer
* bob.learn.libsvm.Trainer
*
* TODO: Not fully implemented yet
*/
...
...
x
bob/learn/libsvm/pyutils.cpp
→
bob/learn/libsvm/pyutils.cpp
View file @
6cc01259
...
...
@@ -7,9 +7,9 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#define
X
BOB_LEARN_LIBSVM_MODULE
#include <
x
bob.blitz/cleanup.h>
#include <
x
bob.learn.libsvm/api.h>
#define BOB_LEARN_LIBSVM_MODULE
#include <bob.blitz/cleanup.h>
#include <bob.learn.libsvm/api.h>
PyObject
*
PyBobLearnLibsvm_MachineTypeAsString
(
bob
::
learn
::
libsvm
::
machine_t
s
)
{
switch
(
s
)
{
...
...
x
bob/learn/libsvm/test_machine.py
→
bob/learn/libsvm/test_machine.py
View file @
6cc01259
...
...
@@ -13,7 +13,7 @@ import numpy
import
tempfile
import
pkg_resources
import
nose.tools
import
x
bob.io.base
import
bob.io.base
from
.
import
File
,
Machine
...
...
@@ -102,11 +102,11 @@ def test_can_save_hdf5():
machine
=
Machine
(
HEART_MACHINE
)
tmp
=
tempname
(
'.hdf5'
)
machine
.
save
(
x
bob
.
io
.
base
.
HDF5File
(
tmp
,
'w'
))
machine
.
save
(
bob
.
io
.
base
.
HDF5File
(
tmp
,
'w'
))
del
machine
# make sure that the save machine is the same as before
machine
=
Machine
(
x
bob
.
io
.
base
.
HDF5File
(
tmp
))
machine
=
Machine
(
bob
.
io
.
base
.
HDF5File
(
tmp
))
nose
.
tools
.
eq_
(
machine
.
shape
,
(
13
,
1
))
nose
.
tools
.
eq_
(
machine
.
kernel_type
,
'RBF'
)
nose
.
tools
.
eq_
(
machine
.
machine_type
,
'C_SVC'
)
...
...
x
bob/learn/libsvm/test_trainer.py
→
bob/learn/libsvm/test_trainer.py
View file @
6cc01259
File moved
x
bob/learn/libsvm/trainer.cpp
→
bob/learn/libsvm/trainer.cpp
View file @
6cc01259
...
...
@@ -7,7 +7,7 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#include <
x
bob.learn.libsvm/trainer.h>
#include <bob.learn.libsvm/trainer.h>
#include <boost/format.hpp>
#include <boost/make_shared.hpp>
#include <bob/core/logging.h>
...
...
x
bob/learn/libsvm/version.cpp
→
bob/learn/libsvm/version.cpp
View file @
6cc01259
...
...
@@ -20,10 +20,10 @@
#ifdef NO_IMPORT_ARRAY
#undef NO_IMPORT_ARRAY
#endif
#include <
x
bob.blitz/capi.h>
#include <
x
bob.blitz/cleanup.h>
#include <
x
bob.io.base/config.h>
#include <
x
bob.learn.libsvm/config.h>
#include <bob.blitz/capi.h>
#include <bob.blitz/cleanup.h>
#include <bob.io.base/config.h>
#include <bob.learn.libsvm/config.h>
static
int
dict_set
(
PyObject
*
d
,
const
char
*
key
,
const
char
*
value
)
{
PyObject
*
v
=
Py_BuildValue
(
"s"
,
value
);
...
...
@@ -109,17 +109,17 @@ static PyObject* numpy_version() {
}
/**
*
x
bob.blitz c/c++ api version
* bob.blitz c/c++ api version
*/
static
PyObject
*
x
bob_blitz_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
X
BOB_BLITZ_API_VERSION
));
static
PyObject
*
bob_blitz_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
BOB_BLITZ_API_VERSION
));
}
/**
*
x
bob.io.base c/c++ api version
* bob.io.base c/c++ api version
*/
static
PyObject
*
x
bob_io_base_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
X
BOB_IO_BASE_API_VERSION
));
static
PyObject
*
bob_io_base_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
BOB_IO_BASE_API_VERSION
));
}
static
PyObject
*
build_version_dictionary
()
{
...
...
@@ -134,8 +134,8 @@ static PyObject* build_version_dictionary() {
if
(
!
dict_steal
(
retval
,
"Compiler"
,
compiler_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"Python"
,
python_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"NumPy"
,
numpy_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"
xbob.blitz"
,
x
bob_blitz_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"
xbob.io.base"
,
x
bob_io_base_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"
bob.blitz"
,
bob_blitz_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"
bob.io.base"
,
bob_io_base_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"Bob"
,
bob_version
()))
return
0
;
Py_INCREF
(
retval
);
...
...
@@ -153,7 +153,7 @@ PyDoc_STRVAR(module_docstr,
#if PY_VERSION_HEX >= 0x03000000
static
PyModuleDef
module_definition
=
{
PyModuleDef_HEAD_INIT
,
X
BOB_EXT_MODULE_NAME
,
BOB_EXT_MODULE_NAME
,
module_docstr
,
-
1
,
module_methods
,
...
...
@@ -166,15 +166,15 @@ static PyObject* create_module (void) {
# if PY_VERSION_HEX >= 0x03000000
PyObject
*
m
=
PyModule_Create
(
&
module_definition
);
# else
PyObject
*
m
=
Py_InitModule3
(
X
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
PyObject
*
m
=
Py_InitModule3
(
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
# endif
if
(
!
m
)
return
0
;
auto
m_
=
make_safe
(
m
);
///< protects against early returns
/* register version numbers and constants */
if
(
PyModule_AddIntConstant
(
m
,
"api"
,
X
BOB_LEARN_LIBSVM_API_VERSION
)
<
0
)
if
(
PyModule_AddIntConstant
(
m
,
"api"
,
BOB_LEARN_LIBSVM_API_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddStringConstant
(
m
,
"module"
,
X
BOB_EXT_MODULE_VERSION
)
<
0
)
if
(
PyModule_AddStringConstant
(
m
,
"module"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
PyObject
*
externals
=
build_version_dictionary
();
...
...
@@ -182,9 +182,9 @@ static PyObject* create_module (void) {
if
(
PyModule_AddObject
(
m
,
"externals"
,
externals
)
<
0
)
return
0
;
/* imports dependencies */
if
(
import_
x
bob_blitz
()
<
0
)
{
if
(
import_bob_blitz
()
<
0
)
{
PyErr_Print
();
PyErr_Format
(
PyExc_ImportError
,
"cannot import `%s'"
,
X
BOB_EXT_MODULE_NAME
);
PyErr_Format
(
PyExc_ImportError
,
"cannot import `%s'"
,
BOB_EXT_MODULE_NAME
);
return
0
;
}
...
...
@@ -193,7 +193,7 @@ static PyObject* create_module (void) {
}
PyMODINIT_FUNC
X
BOB_EXT_ENTRY_NAME
(
void
)
{
PyMODINIT_FUNC
BOB_EXT_ENTRY_NAME
(
void
)
{
# if PY_VERSION_HEX >= 0x03000000
return
# endif
...
...
buildout.cfg
View file @
6cc01259
...
...
@@ -4,25 +4,25 @@
[buildout]
parts = scripts
eggs =
x
bob.learn.libsvm
extensions =
x
bob.buildout
eggs = bob.learn.libsvm
extensions = bob.buildout
mr.developer
auto-checkout = *
develop = src/
x
bob.extension
src/
x
bob.blitz
src/
x
bob.io.base
develop = src/bob.extension
src/bob.blitz
src/bob.io.base
.
; options for
x
bob.buildout extension
; options for bob.buildout extension
debug = true
verbose = true
prefixes = /idiap/group/torch5spro/releases/preview/install/linux-x86_64-release
/Users/andre/work/bob/b/dbg/
[sources]
xbob.extension = git https://github.com/bioidiap/xbob.extension branch=prototype
xbob.blitz = git https://github.com/bioidiap/x
bob.blitz
xbob.io.base = git https://github.com/bioidiap/x
bob.io.base
bob.extension = git https://github.com/bioidiap/bob.extension
bob.blitz = git https://github.com/bioidiap/
bob.blitz
bob.io.base = git https://github.com/bioidiap/
bob.io.base
[scripts]
recipe =
x
bob.buildout:scripts
recipe = bob.buildout:scripts
doc/c_cpp_api.rst
View file @
6cc01259
...
...
@@ -6,11 +6,11 @@
C++ API
=========
The C++ API of ``
x
bob.learn.libsvm`` allows users to leverage from automatic
converters for classes in :py:class:`
x
bob.learn.libsvm`. To use the C API,
clients should first, include the header file ``<
x
bob.learn.libsvm/api.h>`` on
The C++ API of ``bob.learn.libsvm`` allows users to leverage from automatic
converters for classes in :py:class:`bob.learn.libsvm`. To use the C API,
clients should first, include the header file ``<bob.learn.libsvm/api.h>`` on
their compilation units and then, make sure to call once
``import_
x
bob_learn_libsvm()`` at their module instantiation, as explained at
``import_bob_learn_libsvm()`` at their module instantiation, as explained at
the `Python manual
<http://docs.python.org/2/extending/extending.html#using-capsules>`_.
...
...
@@ -19,9 +19,9 @@ the import function:
.. code-block:: c++
#include <
x
bob.blitz/capi.h>
#include <
x
bob.io/api.h>
#include <
x
bob.learn.libsvm/api.h>
#include <bob.blitz/capi.h>
#include <bob.io/api.h>
#include <bob.learn.libsvm/api.h>
PyMODINIT_FUNC initclient(void) {
...
...
@@ -29,9 +29,9 @@ the import function:
if (!m) return 0;
if (import_
x
bob_blitz() < 0) return 0;
if (import_
x
bob_io() < 0) return 0;
if (import_
x
bob_learn_libsvm() < 0) return 0;
if (import_bob_blitz() < 0) return 0;
if (import_bob_io() < 0) return 0;
if (import_bob_learn_libsvm() < 0) return 0;
return m;
...
...
@@ -40,7 +40,7 @@ the import function:
.. note::
The include directory can be discovered using
:py:func:`
x
bob.learn.libsvm.get_include`.
:py:func:`bob.learn.libsvm.get_include`.
File Interface
--------------
...
...
doc/conf.py
View file @
6cc01259
...
...
@@ -58,12 +58,12 @@ source_suffix = '.rst'
master_doc
=
'index'
# General information about the project.
project
=
u'
x
bob.learn.libsvm'
project
=
u'bob.learn.libsvm'
import
time
copyright
=
u'%s, Idiap Research Institute'
%
time
.
strftime
(
'%Y'
)
# Grab the setup entry
distribution
=
pkg_resources
.
require
(
'
x
bob.learn.libsvm'
)[
0
]
distribution
=
pkg_resources
.
require
(
'bob.learn.libsvm'
)[
0
]
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
...
...
@@ -129,7 +129,7 @@ if sphinx.__version__ >= "1.0":
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = '
x
bob_learn_libsvm'
#html_short_title = 'bob_learn_libsvm'
# The name of an image file (relative to this directory) to place at the top