LIBIRWLS
pythonmodule.h
Go to the documentation of this file.
1 /*
2  ============================================================================
3  Author : Roberto Diaz Morales
4  ============================================================================
5 
6  Copyright (c) 2016 Roberto Díaz Morales
7 
8  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
9  (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
10  publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
11  subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14 
15  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
17  FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 
20  ============================================================================
21  */
22 
41 void delModel(PyObject* pymodel);
42 
43 
55 static PyObject *predict (PyObject *dummy, PyObject *args, PyObject *kwds);
56 
68 static PyObject *save (PyObject *dummy, PyObject *args, PyObject *kwds);
69 
70 
82 static PyObject *load (PyObject *dummy, PyObject *args, PyObject *kwds);
83 
84 
95 svm_dataset numpy2dataset(PyObject *arr1,PyObject *arr2);
96 
107 svm_dataset numpy2datasetWithAverage(PyObject *arr1,PyObject *arr2);
108 
120 static PyObject*
121 budgeted_train (PyObject *dummy, PyObject *args, PyObject *kwds);
122 
134 static PyObject*
135 full_train (PyObject *dummy, PyObject *args, PyObject *kwds);
136 
137 
144 static PyMethodDef LIBIRWLSMethods[] = {
145  {"load", (PyCFunction)load, METH_VARARGS|METH_KEYWORDS, "It loads a model from a file"},
146  {"full_train", (PyCFunction)full_train, METH_VARARGS|METH_KEYWORDS, "It trains a SVM using the parallel IRWLS procedure"},
147  {"budgeted_train", (PyCFunction)budgeted_train, METH_VARARGS|METH_KEYWORDS, "It trains a budgeted SVM using the parallel IRWLS procedure"},
148  {"save", (PyCFunction)save, METH_VARARGS|METH_KEYWORDS, "It saves a model in a file"},
149  {"predict", (PyCFunction)predict, METH_VARARGS|METH_KEYWORDS, "Predictions using a trained model"},
150  { NULL, NULL, 0, NULL}
151 };
152 
160 PyMODINIT_FUNC
161 initLIBIRWLS(void);
162 
163 
164 
165 
A dataset.
Definition: IOStructures.h:114
PyMODINIT_FUNC initLIBIRWLS(void)
Initialization of the python module.
Definition: pythonmodule.c:517
svm_dataset numpy2datasetWithAverage(PyObject *arr1, PyObject *arr2)
Convert numpy array to a dataset and the average of every class data.
Definition: pythonmodule.c:277
void delModel(PyObject *pymodel)
Model capsule destructor.
Definition: pythonmodule.c:54
svm_dataset numpy2dataset(PyObject *arr1, PyObject *arr2)
Convert numpy array to a dataset.
Definition: pythonmodule.c:213