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
c8005632
Commit
c8005632
authored
Aug 28, 2014
by
Manuel Günther
Browse files
Removed a skipped test.
parent
a0d806ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
bob/learn/boosting/tests/test_loss_jes.py
View file @
c8005632
...
...
@@ -40,44 +40,3 @@ class TestJesorskyLoss(unittest.TestCase):
self
.
assertTrue
(
grad_sum
.
shape
[
0
]
==
num_outputs
)
@
unittest
.
skip
(
"Implement me!"
)
def
test02_negative_target
(
self
):
loss_function
=
bob
.
learn
.
boosting
.
JesorskyLoss
()
num_samples
=
2
num_outputs
=
4
targets
=
numpy
.
array
([[
10
,
10
,
10
,
30
],
[
12
,
11
,
13
,
29
]])
score
=
numpy
.
array
([[
8
,
9
,
7
,
34
],
[
11
,
6
,
16
,
26
]],
'float64'
)
alpha
=
0.5
weak_scores
=
numpy
.
array
([[
0.2
,
0.4
,
0.5
,
0.6
],
[
0.5
,
0.5
,
0.5
,
0.5
]],
'float64'
)
prev_scores
=
numpy
.
array
([[
0.1
,
0.2
,
0.3
,
0.4
],
[
0.5
,
0.5
,
0.5
,
0.5
]],
'float64'
)
# TODO: implement this test properly
# check the loss values
loss_value
=
loss_function
.
loss
(
targets
,
score
)
val1
=
numpy
.
exp
(
-
targets
*
score
)
self
.
assertTrue
((
loss_value
==
val1
).
all
())
# Check loss gradient
loss_grad
=
loss_function
.
loss_gradient
(
targets
,
score
)
temp
=
numpy
.
exp
(
-
targets
*
score
)
val2
=
-
targets
*
temp
self
.
assertTrue
((
loss_grad
==
val2
).
all
())
# Check loss sum
loss_sum_val
=
loss_function
.
loss_sum
(
alpha
,
targets
,
prev_scores
,
weak_scores
)
curr_scores
=
prev_scores
+
alpha
*
weak_scores
val3
=
sum
(
numpy
.
exp
(
-
targets
*
curr_scores
))
self
.
assertTrue
((
val3
==
loss_sum_val
).
all
())
# Check the gradient sum
grad_sum_val
=
loss_function
.
loss_grad_sum
(
alpha
,
targets
,
prev_scores
,
weak_scores
)
curr_scores
=
prev_scores
+
alpha
*
weak_scores
temp
=
numpy
.
exp
(
-
targets
*
curr_scores
)
grad
=
-
targets
*
temp
val4
=
numpy
.
sum
(
grad
*
weak_scores
,
0
)
self
.
assertTrue
((
val4
==
grad_sum_val
).
all
())
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