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
7f48fc33
"...pytorch/ogb/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "caa6d6072c8344c4c44b9d0c9d7da7add75fcc96"
Commit
7f48fc33
authored
Jun 02, 2011
by
Davis King
Browse files
Made find_clusters_using_kmeans() work with dlib::vector objects.
parent
bae44f67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
dlib/svm/kkmeans.h
dlib/svm/kkmeans.h
+1
-1
dlib/test/kmeans.cpp
dlib/test/kmeans.cpp
+13
-0
No files found.
dlib/svm/kkmeans.h
View file @
7f48fc33
...
@@ -405,7 +405,7 @@ namespace dlib
...
@@ -405,7 +405,7 @@ namespace dlib
typedef
typename
sample_type
::
type
scalar_type
;
typedef
typename
sample_type
::
type
scalar_type
;
sample_type
zero
(
centers
[
0
]);
sample_type
zero
(
centers
[
0
]);
zero
=
0
;
set_all_elements
(
zero
,
0
)
;
std
::
vector
<
unsigned
long
,
alloc
>
center_element_count
;
std
::
vector
<
unsigned
long
,
alloc
>
center_element_count
;
...
...
dlib/test/kmeans.cpp
View file @
7f48fc33
...
@@ -47,6 +47,8 @@ namespace
...
@@ -47,6 +47,8 @@ namespace
std
::
vector
<
sample_type
>
centers
;
std
::
vector
<
sample_type
>
centers
;
pick_initial_centers
(
seed_centers
.
size
(),
centers
,
samples
,
linear_kernel
<
sample_type
>
());
pick_initial_centers
(
seed_centers
.
size
(),
centers
,
samples
,
linear_kernel
<
sample_type
>
());
find_clusters_using_kmeans
(
samples
,
centers
);
DLIB_TEST
(
centers
.
size
()
==
seed_centers
.
size
());
DLIB_TEST
(
centers
.
size
()
==
seed_centers
.
size
());
std
::
vector
<
int
>
hits
(
centers
.
size
(),
0
);
std
::
vector
<
int
>
hits
(
centers
.
size
(),
0
);
...
@@ -95,6 +97,17 @@ namespace
...
@@ -95,6 +97,17 @@ namespace
run_test
(
seed_centers
);
run_test
(
seed_centers
);
}
}
{
dlog
<<
LINFO
<<
"test dlib::vector<double,2>"
;
typedef
dlib
::
vector
<
float
,
2
>
sample_type
;
std
::
vector
<
sample_type
>
seed_centers
;
seed_centers
.
push_back
(
sample_type
(
10
,
10
));
seed_centers
.
push_back
(
sample_type
(
10
,
-
10
));
seed_centers
.
push_back
(
sample_type
(
-
10
,
10
));
seed_centers
.
push_back
(
sample_type
(
-
10
,
-
10
));
run_test
(
seed_centers
);
}
{
{
dlog
<<
LINFO
<<
"test dlib::matrix<double,3,1>"
;
dlog
<<
LINFO
<<
"test dlib::matrix<double,3,1>"
;
typedef
dlib
::
matrix
<
double
,
3
,
1
>
sample_type
;
typedef
dlib
::
matrix
<
double
,
3
,
1
>
sample_type
;
...
...
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