Commit 6cc01259 authored by André Anjos's avatar André Anjos 💬

xbob -> bob

parent b87776ef
......@@ -26,8 +26,8 @@ install:
- "python bootstrap.py"
- "CFLAGS=-coverage ./bin/buildout"
script:
- "./bin/python -c 'from xbob.learn.libsvm import get_config; print(get_config())'"
- "./bin/coverage run --source=xbob.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:
......
include LICENSE README.rst bootstrap.py buildout.cfg
recursive-include doc conf.py doxygen.rc *.rst
recursive-include xbob/learn/libsvm *.cpp *.h
recursive-include xbob/learn/libsvm/data *.*
recursive-include bob/learn/libsvm *.cpp *.h
recursive-include bob/learn/libsvm/data *.*
......@@ -2,16 +2,16 @@
.. Andre Anjos <andre.anjos@idiap.ch>
.. Fri 13 Dec 2013 12:35:22 CET
.. image:: https://travis-ci.org/bioidiap/xbob.learn.libsvm.svg?branch=master
:target: https://travis-ci.org/bioidiap/xbob.learn.libsvm
.. image:: https://coveralls.io/repos/bioidiap/xbob.learn.libsvm/badge.png
:target: https://coveralls.io/r/bioidiap/xbob.learn.libsvm
.. image:: http://img.shields.io/github/tag/bioidiap/xbob.learn.libsvm.png
:target: https://github.com/bioidiap/xbob.learn.libsvm
.. image:: http://img.shields.io/pypi/v/xbob.learn.libsvm.png
:target: https://pypi.python.org/pypi/xbob.learn.libsvm
.. image:: http://img.shields.io/pypi/dm/xbob.learn.libsvm.png
:target: https://pypi.python.org/pypi/xbob.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 ``XBOB_PREFIX_PATH``, **before** building and
installing the package. For example, if ``XBOB_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 xbob.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/xbob.buildout>`_ extension and
set the ``[environ]`` section to define ``XBOB_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 xbob.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=xbob.learn.libsvm
$ nosetests --with-coverage --cover-package=bob.learn.libsvm
The ``coverage`` egg must be installed for this to work properly.
......
......@@ -7,7 +7,7 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#include <xbob.learn.libsvm/file.h>
#include <bob.learn.libsvm/file.h>
#include <boost/format.hpp>
#include <boost/algorithm/string.hpp>
......
......@@ -5,17 +5,17 @@
* @brief C/C++ API for bob::machine
*/
#ifndef XBOB_LEARN_LIBSVM_H
#define XBOB_LEARN_LIBSVM_H
#ifndef BOB_LEARN_LIBSVM_H
#define BOB_LEARN_LIBSVM_H
#include <Python.h>
#include <xbob.learn.libsvm/config.h>
#include <xbob.learn.libsvm/file.h>
#include <xbob.learn.libsvm/machine.h>
#include <xbob.learn.libsvm/trainer.h>
#include <bob.learn.libsvm/config.h>
#include <bob.learn.libsvm/file.h>
#include <bob.learn.libsvm/machine.h>
#include <bob.learn.libsvm/trainer.h>
#define XBOB_LEARN_LIBSVM_MODULE_PREFIX xbob.learn.libsvm
#define XBOB_LEARN_LIBSVM_MODULE_NAME _library
#define BOB_LEARN_LIBSVM_MODULE_PREFIX bob.learn.libsvm
#define BOB_LEARN_LIBSVM_MODULE_NAME _library
/*******************
* C API functions *
......@@ -23,15 +23,15 @@
/* Enum defining entries in the function table */
enum _PyBobLearnLibsvm_ENUM{
PyXbobLearnLibsvm_APIVersion_NUM = 0,
// Bindings for xbob.learn.libsvm.File
PyBobLearnLibsvm_APIVersion_NUM = 0,
// Bindings for bob.learn.libsvm.File
PyBobLearnLibsvmFile_Type_NUM,
PyBobLearnLibsvmFile_Check_NUM,
// Bindings for xbob.learn.libsvm.Machine
// Bindings for bob.learn.libsvm.Machine
PyBobLearnLibsvmMachine_Type_NUM,
PyBobLearnLibsvmMachine_Check_NUM,
PyBobLearnLibsvmMachine_NewFromMachine_NUM,
// Bindings for xbob.learn.libsvm.Trainer
// Bindings for bob.learn.libsvm.Trainer
PyBobLearnLibsvmTrainer_Type_NUM,
PyBobLearnLibsvmTrainer_Check_NUM,
// Bindings to general utilities
......@@ -42,17 +42,17 @@ enum _PyBobLearnLibsvm_ENUM{
PyBobLearnLibsvm_StringAsKernelType_NUM,
PyBobLearnLibsvm_CStringAsKernelType_NUM,
// Total number of C API pointers
PyXbobLearnLibsvm_API_pointers
PyBobLearnLibsvm_API_pointers
};
/**************
* Versioning *
**************/
#define PyXbobLearnLibsvm_APIVersion_TYPE int
#define PyBobLearnLibsvm_APIVersion_TYPE int
/***************************************
* Bindings for xbob.learn.libsvm.File *
* Bindings for bob.learn.libsvm.File *
***************************************/
typedef struct {
......@@ -66,7 +66,7 @@ typedef struct {
#define PyBobLearnLibsvmFile_Check_PROTO (PyObject* o)
/******************************************
* Bindings for xbob.learn.libsvm.Machine *
* Bindings for bob.learn.libsvm.Machine *
******************************************/
typedef struct {
......@@ -83,7 +83,7 @@ typedef struct {
#define PyBobLearnLibsvmMachine_NewFromMachine_PROTO (bob::learn::libsvm::Machine* m)
/******************************************
* Bindings for xbob.learn.libsvm.Trainer *
* Bindings for bob.learn.libsvm.Trainer *
******************************************/
typedef struct {
......@@ -119,18 +119,18 @@ typedef struct {
#define PyBobLearnLibsvm_CStringAsKernelType_PROTO (const char* s)
#ifdef XBOB_LEARN_LIBSVM_MODULE
#ifdef BOB_LEARN_LIBSVM_MODULE
/* This section is used when compiling `xbob.learn.libsvm' itself */
/* This section is used when compiling `bob.learn.libsvm' itself */
/**************
* Versioning *
**************/
extern int PyXbobLearnLibsvm_APIVersion;
extern int PyBobLearnLibsvm_APIVersion;
/***************************************
* Bindings for xbob.learn.libsvm.File *
* Bindings for bob.learn.libsvm.File *
***************************************/
extern PyBobLearnLibsvmFile_Type_TYPE PyBobLearnLibsvmFile_Type;
......@@ -138,7 +138,7 @@ typedef struct {
PyBobLearnLibsvmFile_Check_RET PyBobLearnLibsvmFile_Check PyBobLearnLibsvmFile_Check_PROTO;
/******************************************
* Bindings for xbob.learn.libsvm.Machine *
* Bindings for bob.learn.libsvm.Machine *
******************************************/
extern PyBobLearnLibsvmMachine_Type_TYPE PyBobLearnLibsvmMachine_Type;
......@@ -148,7 +148,7 @@ typedef struct {
PyBobLearnLibsvmMachine_NewFromMachine_RET PyBobLearnLibsvmMachine_NewFromMachine PyBobLearnLibsvmMachine_NewFromMachine_PROTO;
/******************************************
* Bindings for xbob.learn.libsvm.Trainer *
* Bindings for bob.learn.libsvm.Trainer *
******************************************/
extern PyBobLearnLibsvmTrainer_Type_TYPE PyBobLearnLibsvmTrainer_Type;
......@@ -173,7 +173,7 @@ typedef struct {
#else
/* This section is used in modules that use `xbob.learn.libsvm's' C-API */
/* This section is used in modules that use `bob.learn.libsvm's' C-API */
/************************************************************************
* Macros to avoid symbol collision and allow for separate compilation. *
......@@ -182,18 +182,18 @@ typedef struct {
************************************************************************/
# if defined(PY_ARRAY_UNIQUE_SYMBOL)
# define XBOB_LEARN_LIBSVM_MAKE_API_NAME_INNER(a) XBOB_LEARN_LIBSVM_ ## a
# define XBOB_LEARN_LIBSVM_MAKE_API_NAME(a) XBOB_LEARN_LIBSVM_MAKE_API_NAME_INNER(a)
# define PyXbobLearnLibsvm_API XBOB_LEARN_LIBSVM_MAKE_API_NAME(PY_ARRAY_UNIQUE_SYMBOL)
# define BOB_LEARN_LIBSVM_MAKE_API_NAME_INNER(a) BOB_LEARN_LIBSVM_ ## a
# define BOB_LEARN_LIBSVM_MAKE_API_NAME(a) BOB_LEARN_LIBSVM_MAKE_API_NAME_INNER(a)
# define PyBobLearnLibsvm_API BOB_LEARN_LIBSVM_MAKE_API_NAME(PY_ARRAY_UNIQUE_SYMBOL)
# endif
# if defined(NO_IMPORT_ARRAY)
extern void **PyXbobLearnLibsvm_API;
extern void **PyBobLearnLibsvm_API;
# else
# if defined(PY_ARRAY_UNIQUE_SYMBOL)
void **PyXbobLearnLibsvm_API;
void **PyBobLearnLibsvm_API;
# else
static void **PyXbobLearnLibsvm_API=NULL;
static void **PyBobLearnLibsvm_API=NULL;
# endif
# endif
......@@ -201,49 +201,49 @@ typedef struct {
* Versioning *
**************/
# define PyXbobLearnLibsvm_APIVersion (*(PyXbobLearnLibsvm_APIVersion_TYPE *)PyXbobLearnLibsvm_API[PyXbobLearnLibsvm_APIVersion_NUM])
# define PyBobLearnLibsvm_APIVersion (*(PyBobLearnLibsvm_APIVersion_TYPE *)PyBobLearnLibsvm_API[PyBobLearnLibsvm_APIVersion_NUM])
/***************************************
* Bindings for xbob.learn.libsvm.File *
* Bindings for bob.learn.libsvm.File *
***************************************/
# define PyBobLearnLibsvmFile_Type (*(PyBobLearnLibsvmFile_Type_TYPE *)PyXbobLearnLibsvm_API[PyBobLearnLibsvmFile_Type_NUM])
# define PyBobLearnLibsvmFile_Type (*(PyBobLearnLibsvmFile_Type_TYPE *)PyBobLearnLibsvm_API[PyBobLearnLibsvmFile_Type_NUM])
# define PyBobLearnLibsvmFile_Check (*(PyBobLearnLibsvmFile_Check_RET (*)PyBobLearnLibsvmFile_Check_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvmFile_Check_NUM])
# define PyBobLearnLibsvmFile_Check (*(PyBobLearnLibsvmFile_Check_RET (*)PyBobLearnLibsvmFile_Check_PROTO) PyBobLearnLibsvm_API[PyBobLearnLibsvmFile_Check_NUM])
/******************************************
* Bindings for xbob.learn.libsvm.Machine *
* Bindings for bob.learn.libsvm.Machine *
******************************************/
# define PyBobLearnLibsvmMachine_Type (*(PyBobLearnLibsvmMachine_Type_TYPE *)PyXbobLearnLibsvm_API[PyBobLearnLibsvmMachine_Type_NUM])
# define PyBobLearnLibsvmMachine_Type (*(PyBobLearnLibsvmMachine_Type_TYPE *)PyBobLearnLibsvm_API[PyBobLearnLibsvmMachine_Type_NUM])
# define PyBobLearnLibsvmMachine_Check (*(PyBobLearnLibsvmMachine_Check_RET (*)PyBobLearnLibsvmMachine_Check_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvmMachine_Check_NUM])
# define PyBobLearnLibsvmMachine_Check (*(PyBobLearnLibsvmMachine_Check_RET (*)PyBobLearnLibsvmMachine_Check_PROTO) PyBobLearnLibsvm_API[PyBobLearnLibsvmMachine_Check_NUM])
# define PyBobLearnLibsvmMachine_NewFromMachine (*(PyBobLearnLibsvmMachine_NewFromMachine_RET (*)PyBobLearnLibsvmMachine_NewFromMachine_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvmMachine_NewFromMachine_NUM])
# define PyBobLearnLibsvmMachine_NewFromMachine (*(PyBobLearnLibsvmMachine_NewFromMachine_RET (*)PyBobLearnLibsvmMachine_NewFromMachine_PROTO) PyBobLearnLibsvm_API[PyBobLearnLibsvmMachine_NewFromMachine_NUM])
/******************************************
* Bindings for xbob.learn.libsvm.Trainer *
* Bindings for bob.learn.libsvm.Trainer *
******************************************/
# define PyBobLearnLibsvmTrainer_Type (*(PyBobLearnLibsvmTrainer_Type_TYPE *)PyXbobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Type_NUM])
# define PyBobLearnLibsvmTrainer_Type (*(PyBobLearnLibsvmTrainer_Type_TYPE *)PyBobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Type_NUM])
# define PyBobLearnLibsvmTrainer_Check (*(PyBobLearnLibsvmTrainer_Check_RET (*)PyBobLearnLibsvmTrainer_Check_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Check_NUM])
# define PyBobLearnLibsvmTrainer_Check (*(PyBobLearnLibsvmTrainer_Check_RET (*)PyBobLearnLibsvmTrainer_Check_PROTO) PyBobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Check_NUM])
/*********************************
* Bindings to general utilities *
*********************************/
# define PyBobLearnLibsvm_MachineTypeAsString (*(PyBobLearnLibsvm_MachineTypeAsString_RET (*)PyBobLearnLibsvm_MachineTypeAsString_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvm_MachineTypeAsString_NUM])
# define PyBobLearnLibsvm_MachineTypeAsString (*(PyBobLearnLibsvm_MachineTypeAsString_RET (*)PyBobLearnLibsvm_MachineTypeAsString_PROTO) PyBobLearnLibsvm_API[PyBobLearnLibsvm_MachineTypeAsString_NUM])
# define PyBobLearnLibsvm_StringAsMachineType (*(PyBobLearnLibsvm_StringAsMachineType_RET (*)PyBobLearnLibsvm_StringAsMachineType_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvm_StringAsMachineType_NUM])
# define PyBobLearnLibsvm_StringAsMachineType (*(PyBobLearnLibsvm_StringAsMachineType_RET (*)PyBobLearnLibsvm_StringAsMachineType_PROTO) PyBobLearnLibsvm_API[PyBobLearnLibsvm_StringAsMachineType_NUM])
# define PyBobLearnLibsvm_CStringAsMachineType (*(PyBobLearnLibsvm_CStringAsMachineType_RET (*)PyBobLearnLibsvm_CStringAsMachineType_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvm_CStringAsMachineType_NUM])
# define PyBobLearnLibsvm_CStringAsMachineType (*(PyBobLearnLibsvm_CStringAsMachineType_RET (*)PyBobLearnLibsvm_CStringAsMachineType_PROTO) PyBobLearnLibsvm_API[PyBobLearnLibsvm_CStringAsMachineType_NUM])
# define PyBobLearnLibsvm_KernelTypeAsString (*(PyBobLearnLibsvm_KernelTypeAsString_RET (*)PyBobLearnLibsvm_KernelTypeAsString_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvm_KernelTypeAsString_NUM])
# define PyBobLearnLibsvm_KernelTypeAsString (*(PyBobLearnLibsvm_KernelTypeAsString_RET (*)PyBobLearnLibsvm_KernelTypeAsString_PROTO) PyBobLearnLibsvm_API[PyBobLearnLibsvm_KernelTypeAsString_NUM])
# define PyBobLearnLibsvm_StringAsKernelType (*(PyBobLearnLibsvm_StringAsKernelType_RET (*)PyBobLearnLibsvm_StringAsKernelType_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvm_StringAsKernelType_NUM])
# define PyBobLearnLibsvm_StringAsKernelType (*(PyBobLearnLibsvm_StringAsKernelType_RET (*)PyBobLearnLibsvm_StringAsKernelType_PROTO) PyBobLearnLibsvm_API[PyBobLearnLibsvm_StringAsKernelType_NUM])
# define PyBobLearnLibsvm_CStringAsKernelType (*(PyBobLearnLibsvm_CStringAsKernelType_RET (*)PyBobLearnLibsvm_CStringAsKernelType_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvm_CStringAsKernelType_NUM])
# define PyBobLearnLibsvm_CStringAsKernelType (*(PyBobLearnLibsvm_CStringAsKernelType_RET (*)PyBobLearnLibsvm_CStringAsKernelType_PROTO) PyBobLearnLibsvm_API[PyBobLearnLibsvm_CStringAsKernelType_NUM])
# if !defined(NO_IMPORT_ARRAY)
......@@ -251,12 +251,12 @@ typedef struct {
* Returns -1 on error, 0 on success. PyCapsule_Import will set an exception
* if there's an error.
*/
static int import_xbob_learn_libsvm(void) {
static int import_bob_learn_libsvm(void) {
PyObject *c_api_object;
PyObject *module;
module = PyImport_ImportModule(BOOST_PP_STRINGIZE(XBOB_LEARN_LIBSVM_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(XBOB_LEARN_LIBSVM_MODULE_NAME));
module = PyImport_ImportModule(BOOST_PP_STRINGIZE(BOB_LEARN_LIBSVM_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(BOB_LEARN_LIBSVM_MODULE_NAME));
if (module == NULL) return -1;
......@@ -269,35 +269,35 @@ typedef struct {
# if PY_VERSION_HEX >= 0x02070000
if (PyCapsule_CheckExact(c_api_object)) {
PyXbobLearnLibsvm_API = (void **)PyCapsule_GetPointer(c_api_object,
PyBobLearnLibsvm_API = (void **)PyCapsule_GetPointer(c_api_object,
PyCapsule_GetName(c_api_object));
}
# else
if (PyCObject_Check(c_api_object)) {
XbobLearnLibsvm_API = (void **)PyCObject_AsVoidPtr(c_api_object);
BobLearnLibsvm_API = (void **)PyCObject_AsVoidPtr(c_api_object);
}
# endif
Py_DECREF(c_api_object);
Py_DECREF(module);
if (!XbobLearnLibsvm_API) {
if (!BobLearnLibsvm_API) {
PyErr_Format(PyExc_ImportError,
# if PY_VERSION_HEX >= 0x02070000
"cannot find C/C++ API capsule at `%s.%s._C_API'",
# else
"cannot find C/C++ API cobject at `%s.%s._C_API'",
# endif
BOOST_PP_STRINGIZE(XBOB_LEARN_LIBSVM_MODULE_PREFIX),
BOOST_PP_STRINGIZE(XBOB_LEARN_LIBSVM_MODULE_NAME));
BOOST_PP_STRINGIZE(BOB_LEARN_LIBSVM_MODULE_PREFIX),
BOOST_PP_STRINGIZE(BOB_LEARN_LIBSVM_MODULE_NAME));
return -1;
}
/* Checks that the imported version matches the compiled version */
int imported_version = *(int*)PyXbobLearnLibsvm_API[PyXbobLearnLibsvm_APIVersion_NUM];
int imported_version = *(int*)PyBobLearnLibsvm_API[PyBobLearnLibsvm_APIVersion_NUM];
if (XBOB_LEARN_LIBSVM_API_VERSION != imported_version) {
PyErr_Format(PyExc_ImportError, "%s.%s import error: you compiled against API version 0x%04x, but are now importing an API with version 0x%04x which is not compatible - check your Python runtime environment for errors", BOOST_PP_STRINGIZE(XBOB_LEARN_LIBSVM_MODULE_PREFIX), BOOST_PP_STRINGIZE(XBOB_LEARN_LIBSVM_MODULE_NAME), XBOB_LEARN_LIBSVM_API_VERSION, imported_version);
if (BOB_LEARN_LIBSVM_API_VERSION != imported_version) {
PyErr_Format(PyExc_ImportError, "%s.%s import error: you compiled against API version 0x%04x, but are now importing an API with version 0x%04x which is not compatible - check your Python runtime environment for errors", BOOST_PP_STRINGIZE(BOB_LEARN_LIBSVM_MODULE_PREFIX), BOOST_PP_STRINGIZE(BOB_LEARN_LIBSVM_MODULE_NAME), BOB_LEARN_LIBSVM_API_VERSION, imported_version);
return -1;
}
......@@ -308,6 +308,6 @@ typedef struct {
# endif //!defined(NO_IMPORT_ARRAY)
#endif /* XBOB_LEARN_LIBSVM_MODULE */
#endif /* BOB_LEARN_LIBSVM_MODULE */
#endif /* XBOB_LEARN_LIBSVM_H */
#endif /* BOB_LEARN_LIBSVM_H */
......@@ -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 xbob.learn.libsvm
* @brief General directives for all modules in bob.learn.libsvm
*/
#ifndef XBOB_LEARN_LIBSVM_CONFIG_H
#define XBOB_LEARN_LIBSVM_CONFIG_H
#ifndef BOB_LEARN_LIBSVM_CONFIG_H
#define BOB_LEARN_LIBSVM_CONFIG_H
/* Macros that define versions and important names */
#define XBOB_LEARN_LIBSVM_API_VERSION 0x0200
#define BOB_LEARN_LIBSVM_API_VERSION 0x0200
#endif /* XBOB_LEARN_LIBSVM_CONFIG_H */
#endif /* BOB_LEARN_LIBSVM_CONFIG_H */
......@@ -7,7 +7,7 @@
* Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
*/
#include <xbob.learn.libsvm/machine.h>
#include <bob.learn.libsvm/machine.h>
#include <sys/stat.h>
#include <boost/format.hpp>
......
......@@ -5,15 +5,15 @@
* @brief Bindings to bob::machine
*/
#define XBOB_LEARN_LIBSVM_MODULE
#include <xbob.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 <xbob.blitz/capi.h>
#include <xbob.blitz/cleanup.h>
#include <xbob.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 PyXbobLearnLibsvm_APIVersion = XBOB_LEARN_LIBSVM_API_VERSION;
int PyBobLearnLibsvm_APIVersion = BOB_LEARN_LIBSVM_API_VERSION;
#if PY_VERSION_HEX >= 0x03000000
static PyModuleDef module_definition = {
PyModuleDef_HEAD_INIT,
XBOB_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(XBOB_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__", XBOB_LEARN_LIBSVM_API_VERSION) < 0) return 0;
if (PyModule_AddStringConstant(m, "__version__", XBOB_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* PyXbobLearnLibsvm_API[PyXbobLearnLibsvm_API_pointers];
static void* PyBobLearnLibsvm_API[PyBobLearnLibsvm_API_pointers];
/* exhaustive list of C APIs */
......@@ -75,75 +75,75 @@ static PyObject* create_module (void) {
* Versioning *
**************/
PyXbobLearnLibsvm_API[PyXbobLearnLibsvm_APIVersion_NUM] = (void *)&PyXbobLearnLibsvm_APIVersion;
PyBobLearnLibsvm_API[PyBobLearnLibsvm_APIVersion_NUM] = (void *)&PyBobLearnLibsvm_APIVersion;
/***************************************
* Bindings for xbob.learn.libsvm.File *
* Bindings for bob.learn.libsvm.File *
***************************************/
PyXbobLearnLibsvm_API[PyBobLearnLibsvmFile_Type_NUM] = (void *)&PyBobLearnLibsvmFile_Type;
PyBobLearnLibsvm_API[PyBobLearnLibsvmFile_Type_NUM] = (void *)&PyBobLearnLibsvmFile_Type;
PyXbobLearnLibsvm_API[PyBobLearnLibsvmFile_Check_NUM] = (void *)&PyBobLearnLibsvmFile_Check;
PyBobLearnLibsvm_API[PyBobLearnLibsvmFile_Check_NUM] = (void *)&PyBobLearnLibsvmFile_Check;
/******************************************
* Bindings for xbob.learn.libsvm.Machine *
* Bindings for bob.learn.libsvm.Machine *
******************************************/
PyXbobLearnLibsvm_API[PyBobLearnLibsvmMachine_Type_NUM] = (void *)&PyBobLearnLibsvmMachine_Type;
PyBobLearnLibsvm_API[PyBobLearnLibsvmMachine_Type_NUM] = (void *)&PyBobLearnLibsvmMachine_Type;
PyXbobLearnLibsvm_API[PyBobLearnLibsvmMachine_Check_NUM] = (void *)&PyBobLearnLibsvmMachine_Check;
PyBobLearnLibsvm_API[PyBobLearnLibsvmMachine_Check_NUM] = (void *)&PyBobLearnLibsvmMachine_Check;
PyXbobLearnLibsvm_API[PyBobLearnLibsvmMachine_NewFromMachine_NUM] = (void *)&PyBobLearnLibsvmMachine_NewFromMachine;
PyBobLearnLibsvm_API[PyBobLearnLibsvmMachine_NewFromMachine_NUM] = (void *)&PyBobLearnLibsvmMachine_NewFromMachine;
/******************************************
* Bindings for xbob.learn.libsvm.Trainer *
* Bindings for bob.learn.libsvm.Trainer *
******************************************/
PyXbobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Type_NUM] = (void *)&PyBobLearnLibsvmTrainer_Type;
PyBobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Type_NUM] = (void *)&PyBobLearnLibsvmTrainer_Type;
PyXbobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Check_NUM] = (void *)&PyBobLearnLibsvmTrainer_Check;
PyBobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Check_NUM] = (void *)&PyBobLearnLibsvmTrainer_Check;
/*********************************
* Bindings to general utilities *
*********************************/
PyXbobLearnLibsvm_API[PyBobLearnLibsvm_MachineTypeAsString_NUM] = (void *)&PyBobLearnLibsvm_MachineTypeAsString;
PyBobLearnLibsvm_API[PyBobLearnLibsvm_MachineTypeAsString_NUM] = (void *)&PyBobLearnLibsvm_MachineTypeAsString;
PyXbobLearnLibsvm_API[PyBobLearnLibsvm_StringAsMachineType_NUM] = (void *)&PyBobLearnLibsvm_StringAsMachineType;
PyBobLearnLibsvm_API[PyBobLearnLibsvm_StringAsMachineType_NUM] = (void *)&PyBobLearnLibsvm_StringAsMachineType;
PyXbobLearnLibsvm_API[PyBobLearnLibsvm_CStringAsMachineType_NUM] = (void *)&PyBobLearnLibsvm_CStringAsMachineType;
PyBobLearnLibsvm_API[PyBobLearnLibsvm_CStringAsMachineType_NUM] = (void *)&PyBobLearnLibsvm_CStringAsMachineType;
PyXbobLearnLibsvm_API[PyBobLearnLibsvm_KernelTypeAsString_NUM] = (void *)&PyBobLearnLibsvm_KernelTypeAsString;
PyBobLearnLibsvm_API[PyBobLearnLibsvm_KernelTypeAsString_NUM] = (void *)&PyBobLearnLibsvm_KernelTypeAsString;
PyXbobLearnLibsvm_API[PyBobLearnLibsvm_StringAsKernelType_NUM] = (void *)&PyBobLearnLibsvm_StringAsKernelType;
PyBobLearnLibsvm_API[PyBobLearnLibsvm_StringAsKernelType_NUM] = (void *)&PyBobLearnLibsvm_StringAsKernelType;
PyXbobLearnLibsvm_API[PyBobLearnLibsvm_CStringAsKernelType_NUM] = (void *)&PyBobLearnLibsvm_CStringAsKernelType;
PyBobLearnLibsvm_API[PyBobLearnLibsvm_CStringAsKernelType_NUM] = (void *)&PyBobLearnLibsvm_CStringAsKernelType;
#if PY_VERSION_HEX >= 0x02070000
/* defines the PyCapsule */
PyObject* c_api_object = PyCapsule_New((void *)PyXbobLearnLibsvm_API,
XBOB_EXT_MODULE_PREFIX "." XBOB_EXT_MODULE_NAME "._C_API", 0);
PyObject* c_api_object = PyCapsule_New((void *)PyBobLearnLibsvm_API,
BOB_EXT_MODULE_PREFIX "." BOB_EXT_MODULE_NAME "._C_API", 0);
#else
PyObject* c_api_object = PyCObject_FromVoidPtr((void *)PyXbobLearnLibsvm_API, 0);
PyObject* c_api_object = PyCObject_FromVoidPtr((void *)PyBobLearnLibsvm_API, 0);
#endif
if (c_api_object) PyModule_AddObject(m, "_C_API", c_api_object);
/* imports dependencies */
if (import_xbob_blitz() < 0) {
if (import_bob_blitz() < 0) {
PyErr_Print();
PyErr_Format(PyExc_ImportError, "cannot import `%s'", XBOB_EXT_MODULE_NAME);
PyErr_Format(PyExc_ImportError, "cannot import `%s'", BOB_EXT_MODULE_NAME);
return 0;
}
if (import_xbob_io_base() < 0) {
if (import_bob_io_base() < 0) {
PyErr_Print();
PyErr_Format(PyExc_ImportError, "cannot import `%s'", XBOB_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 XBOB_EXT_ENTRY_NAME (void) {
PyMODINIT_FUNC BOB_EXT_ENTRY_NAME (void) {
# if PY_VERSION_HEX >= 0x03000000
return
# endif
......
......@@ -7,18 +7,18 @@
* Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland
*/
#define XBOB_LEARN_LIBSVM_MODULE
#include <xbob.blitz/cppapi.h>
#include <xbob.blitz/cleanup.h>
#include <xbob.io.base/api.h>
#include <xbob.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, XBOB_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:
*
* xbob.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:
*
* xbob.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)>",
......
......@@ -7,18 +7,18 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#define XBOB_LEARN_LIBSVM_MODULE
#include <xbob.blitz/cppapi.h>
#include <xbob.blitz/cleanup.h>
#include <xbob.io.base/api.h>
#include <xbob.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, XBOB_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 xbob.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:
*
* <xbob.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:
*
* xbob.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:`xbob.io.HDF5File`. Saving the SVM into an\n\
:py:class:`xbob.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\
......
......@@ -7,18 +7,18 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#define XBOB_LEARN_LIBSVM_MODULE
#include <xbob.blitz/cppapi.h>
#include <xbob.blitz/cleanup.h>
#include <xbob.io.base/api.h>