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
2b7b4649
Commit
2b7b4649
authored
Feb 06, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added probability_gradient_greater_than() and probability_gradient_less_than()
global functions.
parent
16d4d5d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
0 deletions
+84
-0
running_gradient.h
dlib/statistics/running_gradient.h
+45
-0
running_gradient_abstract.h
dlib/statistics/running_gradient_abstract.h
+39
-0
No files found.
dlib/statistics/running_gradient.h
View file @
2b7b4649
...
...
@@ -151,6 +151,51 @@ namespace dlib
matrix
<
double
,
2
,
1
>
w
;
double
residual_squared
;
};
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
double
probability_gradient_less_than
(
const
T
&
container
,
double
thresh
)
{
running_gradient
g
;
for
(
auto
&&
v
:
container
)
g
.
add
(
v
);
// make sure requires clause is not broken
DLIB_ASSERT
(
g
.
current_n
()
>
2
,
"
\t
double probability_gradient_less_than()"
<<
"
\n\t
You need more than 2 elements in the given container to call this function."
);
return
g
.
probability_gradient_less_than
(
thresh
);
}
template
<
typename
T
>
double
probability_gradient_greater_than
(
const
T
&
container
,
double
thresh
)
{
running_gradient
g
;
for
(
auto
&&
v
:
container
)
g
.
add
(
v
);
// make sure requires clause is not broken
DLIB_ASSERT
(
g
.
current_n
()
>
2
,
"
\t
double probability_gradient_greater_than()"
<<
"
\n\t
You need more than 2 elements in the given container to call this function."
);
return
g
.
probability_gradient_greater_than
(
thresh
);
}
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_RuNNING_GRADIENT_Hh_
...
...
dlib/statistics/running_gradient_abstract.h
View file @
2b7b4649
...
...
@@ -116,6 +116,45 @@ namespace dlib
/*!
provides serialization support
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
double
probability_gradient_less_than
(
const
T
&
container
,
double
thresh
);
/*!
requires
- container muse be a container of double values that can be enumerated with a
range based for loop.
- The container must contain more than 2 elements.
ensures
- Puts all the elements of container into a running_gradient object, R, and
then returns R.probability_gradient_less_than(thresh).
!*/
template
<
typename
T
>
double
probability_gradient_greater_than
(
const
T
&
container
,
double
thresh
);
/*!
requires
- container muse be a container of double values that can be enumerated with a
range based for loop.
- The container must contain more than 2 elements.
ensures
- Puts all the elements of container into a running_gradient object, R, and
then returns R.probability_gradient_greater_than(thresh).
!*/
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_RuNNING_GRADIENT_ABSTRACT_Hh_
...
...
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