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
7e9013f4
Commit
7e9013f4
authored
Jun 14, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made pick_initial_centers() slightly more robust.
parent
2d57a754
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
kkmeans.h
dlib/svm/kkmeans.h
+2
-2
No files found.
dlib/svm/kkmeans.h
View file @
7e9013f4
...
...
@@ -288,7 +288,7 @@ namespace dlib
struct
dlib_pick_initial_centers_data
{
dlib_pick_initial_centers_data
()
:
idx
(
0
),
dist
(
1e200
){}
dlib_pick_initial_centers_data
()
:
idx
(
0
),
dist
(
std
::
numeric_limits
<
double
>::
infinity
()
){}
long
idx
;
double
dist
;
bool
operator
<
(
const
dlib_pick_initial_centers_data
&
d
)
const
{
return
dist
<
d
.
dist
;
}
...
...
@@ -331,7 +331,7 @@ namespace dlib
// pick the first sample as one of the centers
centers
.
push_back
(
samples
[
0
]);
const
long
best_idx
=
static_cast
<
long
>
(
s
amples
.
size
()
-
samples
.
size
()
*
percentile
-
1
);
const
long
best_idx
=
static_cast
<
long
>
(
s
td
::
max
(
0
.
0
,
samples
.
size
()
-
samples
.
size
()
*
percentile
-
1
)
);
// pick the next center
for
(
long
i
=
0
;
i
<
num_centers
-
1
;
++
i
)
...
...
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