Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
bc9bf360
Commit
bc9bf360
authored
Aug 08, 2013
by
Davis King
Browse files
Add checks into the vector_normalizer and vector_normalizer_pca objects
to detect users giving infinite and NaN values as inputs.
parent
ec4865ed
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
dlib/statistics/statistics.h
dlib/statistics/statistics.h
+4
-0
dlib/statistics/statistics_abstract.h
dlib/statistics/statistics_abstract.h
+2
-0
No files found.
dlib/statistics/statistics.h
View file @
bc9bf360
...
@@ -1148,6 +1148,8 @@ namespace dlib
...
@@ -1148,6 +1148,8 @@ namespace dlib
m
=
mean
(
mat
(
samples
));
m
=
mean
(
mat
(
samples
));
sd
=
reciprocal
(
sqrt
(
variance
(
mat
(
samples
))));
sd
=
reciprocal
(
sqrt
(
variance
(
mat
(
samples
))));
DLIB_ASSERT
(
is_finite
(
m
),
"Some of the input vectors to vector_normalizer::train() have infinite or NaN values"
);
}
}
long
in_vector_size
(
long
in_vector_size
(
...
@@ -1310,6 +1312,8 @@ namespace dlib
...
@@ -1310,6 +1312,8 @@ namespace dlib
<<
"
\n\t
this: "
<<
this
<<
"
\n\t
this: "
<<
this
);
);
train_pca_impl
(
mat
(
samples
),
eps
);
train_pca_impl
(
mat
(
samples
),
eps
);
DLIB_ASSERT
(
is_finite
(
m
),
"Some of the input vectors to vector_normalizer_pca::train() have infinite or NaN values"
);
}
}
long
in_vector_size
(
long
in_vector_size
(
...
...
dlib/statistics/statistics_abstract.h
View file @
bc9bf360
...
@@ -770,6 +770,7 @@ namespace dlib
...
@@ -770,6 +770,7 @@ namespace dlib
- samples == a column matrix or something convertible to a column
- samples == a column matrix or something convertible to a column
matrix via mat(). Also, x should contain
matrix via mat(). Also, x should contain
matrix_type objects that represent nonempty column vectors.
matrix_type objects that represent nonempty column vectors.
- samples does not contain any infinite or NaN values
ensures
ensures
- #in_vector_size() == samples(0).nr()
- #in_vector_size() == samples(0).nr()
- #out_vector_size() == samples(0).nr()
- #out_vector_size() == samples(0).nr()
...
@@ -928,6 +929,7 @@ namespace dlib
...
@@ -928,6 +929,7 @@ namespace dlib
- samples == a column matrix or something convertible to a column
- samples == a column matrix or something convertible to a column
matrix via mat(). Also, x should contain
matrix via mat(). Also, x should contain
matrix_type objects that represent nonempty column vectors.
matrix_type objects that represent nonempty column vectors.
- samples does not contain any infinite or NaN values
ensures
ensures
- This object has learned how to normalize vectors that look like
- This object has learned how to normalize vectors that look like
vectors in the given set of samples.
vectors in the given set of 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