Advertisement
jack06215

[dlib] feature normalisation

Jul 17th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. // declares a matrix with 2 rows and 1 column
  2. typedef dlib::matrix<double, 2, 1> sample_type;
  3. .
  4. .
  5. .
  6. (some middle operations)
  7. .
  8. .
  9. .
  10. // here's how to declare a normalizer in dlib
  11. dlib::vector_normalizer<sample_type> normalizer;
  12.  
  13. // let the normalizer learn the mean and standard deviation of the samples
  14. normalizer.train(samples);
  15.  
  16. // now normalize each sample
  17. for (unsigned long i = 0; i < samples.size(); ++i)
  18.     samples[i] = normalizer(samples[i]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement