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
c07029b3
Commit
c07029b3
authored
May 31, 2016
by
Tiago de Freitas Pereira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue
#8
. Segmentation fault when using the __repr__ method
parent
59e3341c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
bob/learn/libsvm/machine.cpp
bob/learn/libsvm/machine.cpp
+3
-3
bob/learn/libsvm/test_machine.py
bob/learn/libsvm/test_machine.py
+2
-0
No files found.
bob/learn/libsvm/machine.cpp
View file @
c07029b3
...
...
@@ -444,11 +444,11 @@ PyObject* PyBobLearnLibsvmMachine_Repr(PyBobLearnLibsvmMachineObject* self) {
* <bob.learn.libsvm.Machine float64@(3, 2)>
*/
auto
shape
=
make_safe
(
PyObject_GetAttrString
((
PyObject
*
)
self
,
"shape"
));
auto
shape_str
=
make_safe
(
PyObject_Str
(
shape
.
get
()
));
PyObject
*
shape
=
Py_BuildValue
(
"(nn)"
,
self
->
cxx
->
inputSize
(),
self
->
cxx
->
outputSize
(
));
PyObject
*
retval
=
PyUnicode_FromFormat
(
"<%s float64@%U>"
,
Py_TYPE
(
self
)
->
tp_name
,
shape_str
.
get
(
));
Py_TYPE
(
self
)
->
tp_name
,
PyObject_Unicode
(
shape
));
#if PYTHON_VERSION_HEX < 0x03000000
if
(
!
retval
)
return
0
;
...
...
bob/learn/libsvm/test_machine.py
View file @
c07029b3
...
...
@@ -79,6 +79,7 @@ def test_can_load():
assert
-
1
in
machine
.
labels
assert
+
1
in
machine
.
labels
assert
abs
(
machine
.
gamma
-
0.0769231
)
<
1e-6
assert
type
(
machine
.
__repr__
())
is
str
def
test_can_save
():
...
...
@@ -252,6 +253,7 @@ def test_correctness_iris():
assert
numpy
.
array_equal
(
pred_labels
,
real_labels
)
assert
numpy
.
all
(
abs
(
numpy
.
vstack
(
pred_probs
)
-
numpy
.
vstack
(
real_probs
))
<
1e-6
)
@
nose
.
tools
.
raises
(
RuntimeError
)
def
test_correctness_inputsize_exceeds
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment