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
a6395a76
Commit
a6395a76
authored
Mar 29, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More robustness improvements to line_search(). Mostly just parameter tweaks.
parent
e03fea5e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
optimization_line_search.h
dlib/optimization/optimization_line_search.h
+13
-6
No files found.
dlib/optimization/optimization_line_search.h
View file @
a6395a76
...
...
@@ -306,8 +306,9 @@ namespace dlib
// the book Practical Methods of Optimization by R. Fletcher. The sectioning
// phase is an implementation of 2.6.4 from the same book.
// 1 < tau1a < tau1b. Controls the alpha jump size during the search
const
double
tau1a
=
2
.
0
;
// 1 <= tau1a < tau1b. Controls the alpha jump size during the bracketing phase of
// the search.
const
double
tau1a
=
1
.
4
;
const
double
tau1b
=
9
;
// it must be the case that 0 < tau2 < tau3 <= 1/2 for the algorithm to function
...
...
@@ -317,7 +318,7 @@ namespace dlib
// Stop right away and return a step size of 0 if the gradient is 0 at the starting point
if
(
std
::
abs
(
d0
)
<
std
::
numeric_limits
<
double
>::
epsilon
())
if
(
std
::
abs
(
d0
)
<
=
std
::
abs
(
f0
)
*
std
::
numeric_limits
<
double
>::
epsilon
())
return
0
;
// Stop right away if the current value is good enough according to min_f
...
...
@@ -397,12 +398,18 @@ namespace dlib
const
double
temp
=
alpha
;
// Pick a larger range [first, last]. We will pick the next alpha in that
// range.
double
first
=
alpha
+
tau1a
*
(
alpha
-
last_alpha
);
double
last
;
double
first
,
last
;
if
(
mu
>
0
)
{
first
=
std
::
min
(
mu
,
alpha
+
tau1a
*
(
alpha
-
last_alpha
));
last
=
std
::
min
(
mu
,
alpha
+
tau1b
*
(
alpha
-
last_alpha
));
}
else
{
first
=
std
::
max
(
mu
,
alpha
+
tau1a
*
(
alpha
-
last_alpha
));
last
=
std
::
max
(
mu
,
alpha
+
tau1b
*
(
alpha
-
last_alpha
));
}
// pick a point between first and last by doing some kind of interpolation
...
...
@@ -462,7 +469,7 @@ namespace dlib
// looks like the first derivative is discontinuous and stop if so. The
// current alpha is plenty good enough in this case.
const
double
second_der
=
std
::
abs
(
a_val_der
-
b_val_der
)
/
std
::
abs
(
a
-
b
);
if
(
s
econd_der
>
1e5
)
if
(
s
td
::
abs
(
a
-
b
)
<
1e-8
&&
second_der
>
1e7
)
return
alpha
;
if
(
(
b
-
a
)
*
val_der
>=
0
)
...
...
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