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
df250a8f
Commit
df250a8f
authored
Sep 25, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made the max iteration limit user settable.
parent
05e75ae3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
3 deletions
+41
-3
vector_normalizer_frobmetric.h
dlib/statistics/vector_normalizer_frobmetric.h
+21
-3
vector_normalizer_frobmetric_abstract.h
dlib/statistics/vector_normalizer_frobmetric_abstract.h
+20
-0
No files found.
dlib/statistics/vector_normalizer_frobmetric.h
View file @
df250a8f
...
...
@@ -153,14 +153,15 @@ namespace dlib
custom_stop_strategy
(
double
C_
,
double
eps_
,
bool
be_verbose_
bool
be_verbose_
,
unsigned
long
max_iter_
)
{
_C
=
C_
;
_cur_iter
=
0
;
_gradient_thresh
=
eps_
;
_max_iter
=
1000
;
_max_iter
=
max_iter_
;
_verbose
=
be_verbose_
;
}
...
...
@@ -217,6 +218,7 @@ namespace dlib
verbose
=
false
;
eps
=
0
.
1
;
C
=
1
;
max_iter
=
5000
;
}
void
be_verbose
(
...
...
@@ -259,6 +261,19 @@ namespace dlib
C
=
C_
;
}
void
set_max_iterations
(
unsigned
long
max_iterations
)
{
max_iter
=
max_iterations
;
}
unsigned
long
get_max_iterations
(
)
const
{
return
max_iter
;
}
double
get_c
(
)
const
{
...
...
@@ -388,7 +403,7 @@ namespace dlib
// Now run the main part of the algorithm
matrix
<
double
,
0
,
0
,
mem_manager_type
>
Aminus
;
find_max_box_constrained
(
lbfgs_search_strategy
(
10
),
custom_stop_strategy
(
C
,
eps
,
verbose
),
custom_stop_strategy
(
C
,
eps
,
verbose
,
max_iter
),
objective
(
data
,
Aminus
),
derivative
(
num_triples
,
data
,
Aminus
),
u
,
0
,
C
/
num_triples
);
...
...
@@ -476,6 +491,7 @@ namespace dlib
bool
verbose
;
double
eps
;
double
C
;
unsigned
long
max_iter
;
// This is just a temporary variable that doesn't contribute to the
// state of this object.
...
...
@@ -500,6 +516,7 @@ namespace dlib
serialize
(
item
.
verbose
,
out
);
serialize
(
item
.
eps
,
out
);
serialize
(
item
.
C
,
out
);
serialize
(
item
.
max_iter
,
out
);
}
// ----------------------------------------------------------------------------------------
...
...
@@ -522,6 +539,7 @@ namespace dlib
deserialize
(
item
.
verbose
,
in
);
deserialize
(
item
.
eps
,
in
);
deserialize
(
item
.
C
,
in
);
deserialize
(
item
.
max_iter
,
in
);
}
// ----------------------------------------------------------------------------------------
...
...
dlib/statistics/vector_normalizer_frobmetric_abstract.h
View file @
df250a8f
...
...
@@ -66,6 +66,7 @@ namespace dlib
- means().size() == 0
- get_epsilon() == 0.1
- get_c() == 1
- get_max_iterations() == 5000
- This object is not verbose
WHAT THIS OBJECT REPRESENTS
...
...
@@ -159,6 +160,25 @@ namespace dlib
smaller values of C may encourage better generalization.
!*/
void
set_max_iterations
(
unsigned
long
max_iterations
);
/*!
ensures
- #get_max_iterations() == max_iterations
!*/
unsigned
long
get_max_iterations
(
)
const
;
/*!
ensures
- The train() routine uses an iterative numerical solver to find the best
distance metric. This function returns the maximum allowable number of
iterations it will use before terminating. Note that typically the
solver terminates prior to the max iteration count limit due to the error
dropping below get_epsilon().
!*/
void
train
(
const
std
::
vector
<
frobmetric_training_sample
<
matrix_type
>
>&
samples
);
...
...
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