| 1474 | |
| 1475 | template <typename vector_type> |
| 1476 | void train ( |
| 1477 | const vector_type& samples |
| 1478 | ) |
| 1479 | { |
| 1480 | // make sure requires clause is not broken |
| 1481 | DLIB_ASSERT(samples.size() > 0, |
| 1482 | "\tvoid vector_normalizer::train()" |
| 1483 | << "\n\tyou have to give a nonempty set of samples to this function" |
| 1484 | << "\n\tthis: " << this |
| 1485 | ); |
| 1486 | |
| 1487 | m = mean(mat(samples)); |
| 1488 | sd = reciprocal(sqrt(variance(mat(samples)))); |
| 1489 | |
| 1490 | DLIB_ASSERT(is_finite(m), "Some of the input vectors to vector_normalizer::train() have infinite or NaN values"); |
| 1491 | } |
| 1492 | |
| 1493 | long in_vector_size ( |
| 1494 | ) const |