Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
39c9a234
Commit
39c9a234
authored
May 19, 2011
by
Davis King
Browse files
Simplified code a little bit.
parent
1f254ef3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
24 deletions
+14
-24
dlib/svm/structural_svm_problem.h
dlib/svm/structural_svm_problem.h
+14
-24
No files found.
dlib/svm/structural_svm_problem.h
View file @
39c9a234
...
...
@@ -47,6 +47,7 @@ namespace dlib
psi
.
clear
();
lru_count
.
clear
();
if
(
prob
->
get_max_cache_size
()
!=
0
)
prob
->
get_truth_joint_feature_vector
(
idx
,
true_psi
);
}
...
...
@@ -54,7 +55,10 @@ namespace dlib
feature_vector_type
&
psi
)
const
{
if
(
prob
->
get_max_cache_size
()
!=
0
)
psi
=
true_psi
;
else
prob
->
get_truth_joint_feature_vector
(
sample_idx
,
psi
);
}
void
separation_oracle_cached
(
...
...
@@ -320,25 +324,18 @@ namespace dlib
feature_vector_type
ftemp
;
const
unsigned
long
num
=
get_num_samples
();
// initialize the cache
if necessary
.
if
(
cache
.
size
()
==
0
&&
max_cache_size
!=
0
)
// initialize the cache
and compute psi_true
.
if
(
cache
.
size
()
==
0
)
{
cache
.
resize
(
get_num_samples
());
for
(
unsigned
long
i
=
0
;
i
<
cache
.
size
();
++
i
)
cache
[
i
].
init
(
this
,
i
);
}
// initialize psi_true if necessary.
if
(
psi_true
.
size
()
==
0
)
{
psi_true
.
set_size
(
w
.
size
(),
1
);
psi_true
=
0
;
for
(
unsigned
long
i
=
0
;
i
<
num
;
++
i
)
{
if
(
cache
.
size
()
==
0
)
get_truth_joint_feature_vector
(
i
,
ftemp
);
else
cache
[
i
].
get_truth_joint_feature_vector_cached
(
ftemp
);
sparse_vector
::
subtract_from
(
psi_true
,
ftemp
);
...
...
@@ -379,12 +376,6 @@ namespace dlib
scalar_type
&
loss
,
feature_vector_type
&
psi
)
const
{
if
(
cache
.
size
()
==
0
)
{
separation_oracle
(
idx
,
current_solution
,
loss
,
psi
);
}
else
{
cache
[
idx
].
separation_oracle_cached
(
skip_cache
,
cur_risk_lower_bound
,
...
...
@@ -392,7 +383,6 @@ namespace dlib
loss
,
psi
);
}
}
private:
...
...
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