Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
6d48b166
Commit
6d48b166
authored
Dec 07, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added methods to get the assignment by reference rather than returning
a copy by value.
parent
407e9aff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
4 deletions
+40
-4
assignment_function.h
dlib/svm/assignment_function.h
+22
-4
assignment_function_abstract.h
dlib/svm/assignment_function_abstract.h
+18
-0
No files found.
dlib/svm/assignment_function.h
View file @
6d48b166
...
...
@@ -99,14 +99,17 @@ namespace dlib
bool
forces_assignment
(
)
const
{
return
force_assignment
;
}
result_type
operator
()
(
void
predict_assignments
(
const
std
::
vector
<
lhs_element
>&
lhs
,
const
std
::
vector
<
rhs_element
>&
rhs
const
std
::
vector
<
rhs_element
>&
rhs
,
result_type
&
assignment
)
const
{
using
dlib
::
sparse_vector
::
dot
;
using
dlib
::
dot
;
assignment
.
clear
();
matrix
<
double
>
cost
;
unsigned
long
size
;
if
(
force_assignment
)
...
...
@@ -139,7 +142,6 @@ namespace dlib
}
}
std
::
vector
<
long
>
assignment
;
if
(
cost
.
size
()
!=
0
)
{
...
...
@@ -157,8 +159,24 @@ namespace dlib
if
(
assignment
[
i
]
>=
(
long
)
rhs
.
size
())
assignment
[
i
]
=
-
1
;
}
}
return
assignment
;
void
predict_assignments
(
const
sample_type
&
item
,
result_type
&
assignment
)
const
{
predict_assignments
(
item
.
first
,
item
.
second
,
assignment
);
}
result_type
operator
()(
const
std
::
vector
<
lhs_element
>&
lhs
,
const
std
::
vector
<
rhs_element
>&
rhs
)
const
{
result_type
temp
;
predict_assignments
(
lhs
,
rhs
,
temp
);
return
temp
;
}
result_type
operator
()
(
...
...
dlib/svm/assignment_function_abstract.h
View file @
6d48b166
...
...
@@ -247,6 +247,24 @@ namespace dlib
- returns (*this)(item.first, item.second);
!*/
void
predict_assignments
(
const
sample_type
&
item
,
result_type
&
assignment
)
const
;
/*!
ensures
- #assignment == (*this)(item)
!*/
void
predict_assignments
(
const
std
::
vector
<
lhs_element
>&
lhs
,
const
std
::
vector
<
rhs_element
>&
rhs
result_type
&
assignment
)
const
;
/*!
ensures
- #assignment == (*this)(lhs,rhs)
!*/
};
// ----------------------------------------------------------------------------------------
...
...
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