MCPcopy Create free account
hub / github.com/davisking/dlib / test_exponential_distribution

Function test_exponential_distribution

dlib/test/rand.cpp:430–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428 }
429
430 void test_exponential_distribution()
431 {
432 print_spinner();
433 dlib::rand rnd(0);
434
435 const size_t N = 1024*1024*5;
436
437 const double lambda = 1.5;
438 print_spinner();
439 dlib::running_stats<double> stats;
440 for (size_t i = 0; i < N; i++)
441 stats.add(rnd.get_random_exponential(lambda));
442
443 DLIB_TEST(std::abs(stats.mean() - 1.0 / lambda) < 0.001);
444 DLIB_TEST(std::abs(stats.variance() - 1.0 / (lambda*lambda)) < 0.001);
445 DLIB_TEST(std::abs(stats.skewness() - 2.0) < 0.01);
446 DLIB_TEST(std::abs(stats.ex_kurtosis() - 6.0) < 0.1);
447 }
448
449 void test_beta_distribution()
450 {

Callers 1

perform_testMethod · 0.85

Calls 8

print_spinnerFunction · 0.85
absFunction · 0.85
skewnessMethod · 0.80
ex_kurtosisMethod · 0.80
addMethod · 0.45
meanMethod · 0.45
varianceMethod · 0.45

Tested by

no test coverage detected