| 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 | { |
no test coverage detected