bob.learn.libsvm issueshttps://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues2018-06-13T08:44:14Zhttps://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/6Error using NU_SVC machine2018-06-13T08:44:14ZAndré AnjosError using NU_SVC machine*Created by: acostapazo*
I got the following error using a trainer with machine_type=='NU_SVC'
RuntimeError: 1D `input' array should have 0 elements matching `bob.learn.libsvm.Machine' input size, not 3 elements
I tried to reprodu...*Created by: acostapazo*
I got the following error using a trainer with machine_type=='NU_SVC'
RuntimeError: 1D `input' array should have 0 elements matching `bob.learn.libsvm.Machine' input size, not 3 elements
I tried to reproduce this behaviour using the following code. Here we can observe that with random data (100 per each classes) all works in a expected way, but if I use different data, the machine that I get from the trainer seams corrupted. Take note that the machine shape is very unexpected in the second test and this produces the error.
```
import os
import numpy
numpy.random.seed(10)
import bob.learn.libsvm
def svm_predict(svm_machine, data):
labels = [svm_machine.predict_class_and_scores(x)[0][0] for x in data]
return numpy.array(labels)
def train_and_test(train_class1,train_class2,test):
svm_trainer = bob.learn.libsvm.Trainer(machine_type='NU_SVC')
svm_machine = svm_trainer.train([train_class1,train_class2])
print svm_machine.shape
pred_test = svm_predict(svm_machine,test)
return pred_test
print 'Test 1 ************************************************************'
train_class1 = 0.4 * numpy.random.randn(100, 3).astype(numpy.float64)
train_class2 = 0.6 * numpy.random.randn(100, 3).astype(numpy.float64)
test = 0.4 * numpy.random.randn(20, 3).astype(numpy.float64)
pred_test = train_and_test(train_class1,train_class2,test)
print 'Test 2 (less data) *************************************************'
train_class1 = 0.4 * numpy.random.randn(60, 3).astype(numpy.float64)
train_class2 = 0.6 * numpy.random.randn(290, 3).astype(numpy.float64)
test = 0.4 * numpy.random.randn(20, 3).astype(numpy.float64)
pred_test = train_and_test(train_class1,train_class2,test)
```https://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/3Regression using SVM is not supported2018-06-05T07:59:22ZAndré AnjosRegression using SVM is not supported*Created by: tiagofrepereira2012*
Issue copied from here: https://github.com/idiap/bob/issues/182
#################
@laurentes
We should either update the documentation and remove options such as NU_SVR, or support the regressio...*Created by: tiagofrepereira2012*
Issue copied from here: https://github.com/idiap/bob/issues/182
#################
@laurentes
We should either update the documentation and remove options such as NU_SVR, or support the regression task correctly.
@anjos
Supporting a regression task could be easily patched by adding another method to the class called double regress(const blitz::Array<double,1>& input).
To make that clean, one would need to check for NU_SVR || EPSILON_SVR all over the place to make sure the user is not trying to predict classes with a regression SVM.
Another alternative (I'm not sure that would be better) would be to create two inherited classes ClassificationSupportVector and RegressionSupportVector, which only contain specific methods for those tasks, avoiding the excessive checking. All common functionality remains in SupportVector.
Please share your thoughts.https://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/9SVM in sequence segmenation fault2017-10-21T19:07:03ZTiago de Freitas PereiraSVM in sequence segmenation faultWhen you try to train several SVMs in sequence we have segmentation fault.
Follow a code that reproduces the issue (2 SVMs in sequence):
```
import bob.learn.libsvm
import numpy
numpy.random.seed(10)
for i in range(2):
pos = numpy....When you try to train several SVMs in sequence we have segmentation fault.
Follow a code that reproduces the issue (2 SVMs in sequence):
```
import bob.learn.libsvm
import numpy
numpy.random.seed(10)
for i in range(2):
pos = numpy.random.normal(0., 1, size=(100, 2))
neg = numpy.random.normal(1., 1, size=(100, 2))
data = [pos, neg]
trainer = bob.learn.libsvm.Trainer()
trainer.kernel_type = 'LINEAR'
trainer.cost = 1
trainer.train(data)
```
However, if you free the data variables in the end of loop for, everything runs fine
```
import bob.learn.libsvm
import numpy
numpy.random.seed(10)
for i in range(2):
pos = numpy.random.normal(0., 1, size=(100, 2))
neg = numpy.random.normal(1., 1, size=(100, 2))
data = [pos, neg]
trainer = bob.learn.libsvm.Trainer()
trainer.kernel_type = 'LINEAR'
trainer.cost = 1
trainer.train(data)
del data
del pos
del neg
```
I'm still debugging, but it seems that the issue is somewhere here in the bindings (https://gitlab.idiap.ch/bob/bob.learn.libsvm/blob/master/bob/learn/libsvm/trainer.cpp#L616)Bob 2.7.x releaseTiago de Freitas PereiraTiago de Freitas Pereirahttps://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/8Segmentation fault when printing bob.learn.libsvm.Machine2017-10-21T19:07:03ZAndré AnjosSegmentation fault when printing bob.learn.libsvm.Machine*Created by: 183amir*
Here is the code that leads to the segmentation fault:
```python
import bob.io.base
import bob.learn.libsvm
fin = bob.io.base.HDF5File('scores/svm/regular/svm_machine.hdf5', 'r')
fin.cd('svm_machine')
s...*Created by: 183amir*
Here is the code that leads to the segmentation fault:
```python
import bob.io.base
import bob.learn.libsvm
fin = bob.io.base.HDF5File('scores/svm/regular/svm_machine.hdf5', 'r')
fin.cd('svm_machine')
svm_machine = bob.learn.libsvm.Machine(fin)
fin.cd('/')
fin.close()
print(svm_machine) # < -- it happens here!
```
Here is the back trace:
```
bin/gdb-python test.py
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /bob-stable/py27/bin/python...(no debugging symbols found)...done.
Starting program: /bob-stable-2016-05-09/py27/bin/python test.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff1403700 (LWP 16549)]
[New Thread 0x7ffff0c02700 (LWP 16550)]
[New Thread 0x7fffee401700 (LWP 16551)]
[New Thread 0x7fffebc00700 (LWP 16552)]
[New Thread 0x7fffe93ff700 (LWP 16553)]
Program received signal SIGSEGV, Segmentation fault.
__memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:33
33 ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S: No such file or directory.
(gdb) bt
#0 __memcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:33
#1 0x000000000047da9f in ?? ()
#2 0x00000000005e9b69 in PyUnicodeUCS4_FromFormat ()
#3 0x00007fffe209cf0a in PyBobLearnLibsvmMachine_Repr(PyBobLearnLibsvmMachineObject*) ()
from /bob-stable-2016-05-09/py27/local/lib/python2.7/site-packages/bob/learn/libsvm/_library.so
#4 0x000000000052ef8c in PyObject_Str ()
#5 0x000000000052db50 in ?? ()
#6 0x000000000052cd3b in PyFile_WriteObject ()
#7 0x00000000004d08a7 in PyEval_EvalFrameEx ()
#8 0x00000000004c87a1 in PyEval_EvalCodeEx ()
#9 0x00000000005030ef in ?? ()
#10 0x00000000004f8c72 in PyRun_FileExFlags ()
#11 0x00000000004f7d77 in PyRun_SimpleFileExFlags ()
#12 0x00000000004982f2 in Py_Main ()
#13 0x00007ffff6f12b45 in __libc_start_main (main=0x497d80 <main>, argc=2, argv=0x7fffffffdd88, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdd78)
at libc-start.c:287
#14 0x0000000000497ca0 in _start ()
```https://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/4ONE-CLASS SVM is not supported2017-10-21T19:07:03ZAndré AnjosONE-CLASS SVM is not supported*Created by: acostapazo*
It would be interesting that the package had implemented this feature. It will allow us to train svm machines using only one class data.
I am going to fork the repo in order to submit a pull-request for OC-SV...*Created by: acostapazo*
It would be interesting that the package had implemented this feature. It will allow us to train svm machines using only one class data.
I am going to fork the repo in order to submit a pull-request for OC-SVM support.
https://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/2Number of support vectors for a SVM model2017-10-21T19:07:03ZAndré AnjosNumber of support vectors for a SVM model*Created by: tiagofrepereira2012*
Today is not possible to check the number of support vectors using the bob.learn.libsvm.Machine class.
Would be useful to have this feature.*Created by: tiagofrepereira2012*
Today is not possible to check the number of support vectors using the bob.learn.libsvm.Machine class.
Would be useful to have this feature.https://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/1Failing (crashing) nosetests in debug mode2017-10-21T19:07:03ZAndré AnjosFailing (crashing) nosetests in debug mode*Created by: siebenkopf*
When compiled in debug mode, the following nose test:
``` sh
$ bin/nosetests bob.learn.libsvm.test_machine:test_data_loading -vs
```
will crash with a:
``` sh
[Blitz++] Precondition failure: Module /remo...*Created by: siebenkopf*
When compiled in debug mode, the following nose test:
``` sh
$ bin/nosetests bob.learn.libsvm.test_machine:test_data_loading -vs
```
will crash with a:
``` sh
[Blitz++] Precondition failure: Module /remote/idiap.svm/group.torch5spro/externals/py27-debug/usr/include/blitz/array/slicing.cc line 303
Slice is out of range for array: index=270 rank=0
Possible range for index: [0, 269]
python: /remote/idiap.svm/group.torch5spro/externals/py27-debug/usr/include/blitz/array/slicing.cc:303: void blitz::Array<P_numtype, N_rank>::slice(int&, int, blitz::Array<P_numtype, N_rank2>&, blitz::TinyVector<int, N_rank>&, int) [with int N_rank2 = 2; P_numtype = double; int N_rank = 1]: Assertion `0' failed.
Aborted
```
The issue seems to be located in https://github.com/bioidiap/bob.learn.libsvm/blob/master/bob/learn/libsvm/file.cpp#L492, where the k index is getting too high.
To reproduce the issue, checkout bob.learn.libsvm, bootstrap with the debug python version, e.g.:
``` sh
$ /idiap/group/torch5spro/externals/py27-debug/usr/bin/python bootstrap-buildout.py
```
and run the command above.
Happy debugging!https://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/10LIBSVM_VERSION is passed as a string to the compiler, but evaluated as uint64...2018-06-11T07:27:07ZManuel Günthersiebenkopf@googlemail.comLIBSVM_VERSION is passed as a string to the compiler, but evaluated as uint64_t in the codeRelated to bob/bob.extension#58.
In the `setup.py`, the `LIBSVM_VERSION` is passed as a compiler parameter in form of a string `"a.b"`. However, in the source code, it is evaluated as a `uint64_t`, e.g.: https://gitlab.idiap.ch/bob/bob....Related to bob/bob.extension#58.
In the `setup.py`, the `LIBSVM_VERSION` is passed as a compiler parameter in form of a string `"a.b"`. However, in the source code, it is evaluated as a `uint64_t`, e.g.: https://gitlab.idiap.ch/bob/bob.learn.libsvm/blob/d8fd7b158bf5d6225d1e472bec20812c493b28be/bob/learn/libsvm/cpp/machine.cpp#L386
Apparently, the parameter passed on the compiler command line is (luckily) ignored, but the one provided in the svm header file is used instead. So, we should remove the one passed on the command line.Manuel Günthersiebenkopf@googlemail.comManuel Günthersiebenkopf@googlemail.comhttps://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/11Trained machine shape different from input shape2020-10-08T08:11:45ZGuillaume HEUSCHTrained machine shape different from input shapeHi,
When using ``bob.learn.libsvm`` in my own project (through ``bob.pad.face``). I sometimes got the following error:
```bash
RuntimeError: 2D `input' array should have 86 columns, matching `bob.learn.libsvm.Machine' input size, not 9...Hi,
When using ``bob.learn.libsvm`` in my own project (through ``bob.pad.face``). I sometimes got the following error:
```bash
RuntimeError: 2D `input' array should have 86 columns, matching `bob.learn.libsvm.Machine' input size, not 96
```
So basically the trained machine input size does not correspond to the feature size, which is quite odd ...
A first issue (https://gitlab.idiap.ch/bob/bob.pad.base/issues/19) was open there by myself, but I guess that here is more appropriate.
Also, I tracked down the error in the C++ code, and it happens here:
https://gitlab.idiap.ch/bob/bob.learn.libsvm/blob/master/bob/learn/libsvm/machine.cpp#L543
@andre.anjos any idea on this one ?
ThanksGuillaume HEUSCHGuillaume HEUSCHhttps://gitlab.idiap.ch/bob/bob.learn.libsvm/-/issues/12DEPRECATION2021-09-17T14:19:31ZTiago de Freitas PereiraDEPRECATIONThis package will be deprecatedThis package will be deprecatedBob 9.0.0Amir MOHAMMADIAmir MOHAMMADI