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
ab2cd129
Commit
ab2cd129
authored
Jan 08, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made running_gradient serializable.
parent
5435c56d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
running_gradient.h
dlib/statistics/running_gradient.h
+23
-0
running_gradient_abstract.h
dlib/statistics/running_gradient_abstract.h
+16
-0
No files found.
dlib/statistics/running_gradient.h
View file @
ab2cd129
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include "running_gradient_abstract.h"
#include "running_gradient_abstract.h"
#include "../algs.h"
#include "../algs.h"
#include "../serialize.h"
#include <cmath>
#include <cmath>
#include "../matrix.h"
#include "../matrix.h"
...
@@ -115,6 +116,28 @@ namespace dlib
...
@@ -115,6 +116,28 @@ namespace dlib
return
1
-
probability_gradient_less_than
(
thresh
);
return
1
-
probability_gradient_less_than
(
thresh
);
}
}
friend
void
serialize
(
const
running_gradient
&
item
,
std
::
ostream
&
out
)
{
int
version
=
1
;
serialize
(
version
,
out
);
serialize
(
item
.
n
,
out
);
serialize
(
item
.
R
,
out
);
serialize
(
item
.
w
,
out
);
serialize
(
item
.
residual_squared
,
out
);
}
friend
void
deserialize
(
running_gradient
&
item
,
std
::
ostream
&
in
)
{
int
version
=
0
;
deserialize
(
version
,
in
);
if
(
version
!=
1
)
throw
serialization_error
(
"Unexpected version found while deserializing dlib::running_gradient."
);
deserialize
(
item
.
n
,
in
);
deserialize
(
item
.
R
,
in
);
deserialize
(
item
.
w
,
in
);
deserialize
(
item
.
residual_squared
,
in
);
}
private
:
private
:
static
double
normal_cfd
(
double
value
,
double
mean
,
double
stddev
)
static
double
normal_cfd
(
double
value
,
double
mean
,
double
stddev
)
...
...
dlib/statistics/running_gradient_abstract.h
View file @
ab2cd129
...
@@ -100,6 +100,22 @@ namespace dlib
...
@@ -100,6 +100,22 @@ namespace dlib
!*/
!*/
};
};
void
serialize
(
const
running_gradient
&
item
,
std
::
ostream
&
out
);
/*!
provides serialization support
!*/
void
deserialize
(
running_gradient
&
item
,
std
::
istream
&
in
);
/*!
provides serialization support
!*/
}
}
#endif // DLIB_RuNNING_GRADIENT_ABSTRACT_Hh_
#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