Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.boosting
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.learn.boosting
Commits
c8005632
Commit
c8005632
authored
10 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Removed a skipped test.
parent
a0d806ee
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/learn/boosting/tests/test_loss_jes.py
+0
-41
0 additions, 41 deletions
bob/learn/boosting/tests/test_loss_jes.py
with
0 additions
and
41 deletions
bob/learn/boosting/tests/test_loss_jes.py
+
0
−
41
View file @
c8005632
...
@@ -40,44 +40,3 @@ class TestJesorskyLoss(unittest.TestCase):
...
@@ -40,44 +40,3 @@ class TestJesorskyLoss(unittest.TestCase):
self
.
assertTrue
(
grad_sum
.
shape
[
0
]
==
num_outputs
)
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
())
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment