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
73b54620
Commit
73b54620
authored
Jan 19, 2014
by
Davis King
Browse files
Added an overload of pick_initial_centers() that uses the linear kernel when no
other kernel is specified by the user.
parent
d5b5c281
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletion
+45
-1
dlib/svm/kkmeans.h
dlib/svm/kkmeans.h
+19
-1
dlib/svm/kkmeans_abstract.h
dlib/svm/kkmeans_abstract.h
+26
-0
No files found.
dlib/svm/kkmeans.h
View file @
73b54620
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#include "../matrix/matrix_abstract.h"
#include "../matrix/matrix_abstract.h"
#include "../algs.h"
#include "../algs.h"
#include "../serialize.h"
#include "../serialize.h"
#include "kernel
_abstract
.h"
#include "kernel.h"
#include "../array.h"
#include "../array.h"
#include "kcentroid.h"
#include "kcentroid.h"
#include "kkmeans_abstract.h"
#include "kkmeans_abstract.h"
...
@@ -361,6 +361,24 @@ namespace dlib
...
@@ -361,6 +361,24 @@ namespace dlib
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
vector_type1
,
typename
vector_type2
>
void
pick_initial_centers
(
long
num_centers
,
vector_type1
&
centers
,
const
vector_type2
&
samples
,
double
percentile
=
0.01
)
{
typedef
typename
vector_type1
::
value_type
sample_type
;
linear_kernel
<
sample_type
>
kern
;
pick_initial_centers
(
num_centers
,
centers
,
samples
,
kern
,
percentile
);
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
...
...
dlib/svm/kkmeans_abstract.h
View file @
73b54620
...
@@ -237,6 +237,32 @@ namespace dlib
...
@@ -237,6 +237,32 @@ namespace dlib
- #centers == a vector containing the candidate centers found
- #centers == a vector containing the candidate centers found
!*/
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
vector_type1
,
typename
vector_type2
>
void
pick_initial_centers
(
long
num_centers
,
vector_type1
&
centers
,
const
vector_type2
&
samples
,
double
percentile
=
0.01
);
/*!
requires
- num_centers > 1
- 0 <= percentile < 1
- samples.size() > 1
- vector_type1 == something with an interface compatible with std::vector
- vector_type2 == something with an interface compatible with std::vector
- Both centers and samples must be able to contain dlib::matrix based row or
column vectors.
ensures
- performs: pick_initial_centers(num_centers, centers, samples, linear_kernel<sample_type>(), percentile)
(i.e. this function is simply an overload that uses the linear kernel.
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
...
...
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