Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.learn.boosting
Commits
79c1e29d
Commit
79c1e29d
authored
Feb 27, 2014
by
Manuel Günther
Browse files
Improved python3 compatibility.
parent
e0da0361
Changes
4
Hide whitespace changes
Inline
Side-by-side
xbob/boosting/__init__.py
View file @
79c1e29d
# import the C++ stuff
from
._boosting
import
StumpMachine
,
LUTMachine
,
BoostedMachine
,
weighted_histogram
#
import trainer
and loss functions
import
trainer
import
loss
from
.
import
trainer
from
.
import
loss
#import examples
#import tests
xbob/boosting/loss/__init__.py
View file @
79c1e29d
from
ExponentialLoss
import
ExponentialLoss
from
LogitLoss
import
LogitLoss
from
TangentialLoss
import
TangentialLoss
from
JesorskyLoss
import
JesorskyLoss
from
.
ExponentialLoss
import
ExponentialLoss
from
.
LogitLoss
import
LogitLoss
from
.
TangentialLoss
import
TangentialLoss
from
.
JesorskyLoss
import
JesorskyLoss
xbob/boosting/tests/test_boosting.py
View file @
79c1e29d
...
...
@@ -54,7 +54,7 @@ class TestBoosting(unittest.TestCase):
# check the result
weight
=
1.83178082
self
.
assertEqual
(
machine
.
weights
.
shape
,
(
1
,
1
))
self
.
assert
AlmostEqual
(
machine
.
weights
,
-
weight
)
self
.
assert
True
(
numpy
.
allclose
(
machine
.
weights
,
-
weight
)
)
self
.
assertEqual
(
len
(
machine
.
weak_machines
),
1
)
self
.
assertEqual
(
machine
.
indices
,
[
483
])
weak
=
machine
.
weak_machines
[
0
]
...
...
@@ -89,7 +89,7 @@ class TestBoosting(unittest.TestCase):
weight
=
15.46452387
machine
=
booster
.
train
(
inputs
.
astype
(
numpy
.
uint16
),
aligned
)
self
.
assertEqual
(
machine
.
weights
.
shape
,
(
1
,
1
))
self
.
assert
AlmostEqual
(
machine
.
weights
,
-
weight
)
self
.
assert
True
(
numpy
.
allclose
(
machine
.
weights
,
-
weight
)
)
self
.
assertEqual
(
len
(
machine
.
weak_machines
),
1
)
self
.
assertEqual
(
machine
.
indices
,
[
379
])
weak
=
machine
.
weak_machines
[
0
]
...
...
@@ -162,7 +162,6 @@ class TestBoosting(unittest.TestCase):
self
.
assertEqual
(
machine
.
weights
.
shape
,
(
1
,
len
(
digits
)))
self
.
assertTrue
(
numpy
.
allclose
(
machine
.
weights
,
-
weights
))
self
.
assertEqual
(
len
(
machine
.
weak_machines
),
1
)
print
machine
.
indices
self
.
assertTrue
(
all
(
machine
.
indices
==
[
215
,
236
,
264
,
349
]))
weak
=
machine
.
weak_machines
[
0
]
self
.
assertTrue
(
isinstance
(
weak
,
xbob
.
boosting
.
LUTMachine
))
...
...
xbob/boosting/trainer/__init__.py
View file @
79c1e29d
from
LUTTrainer
import
LUTTrainer
from
StumpTrainer
import
StumpTrainer
from
Boosting
import
Boosting
from
.
LUTTrainer
import
LUTTrainer
from
.
StumpTrainer
import
StumpTrainer
from
.
Boosting
import
Boosting
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