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

Method test_average_precision

dlib/test/statistics.cpp:702–729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

700 }
701
702 void test_average_precision()
703 {
704 std::vector<bool> items;
705 DLIB_TEST(average_precision(items) == 1);
706 DLIB_TEST(average_precision(items,1) == 0);
707
708 items.push_back(true);
709 DLIB_TEST(average_precision(items) == 1);
710 DLIB_TEST(std::abs(average_precision(items,1) - 0.5) < 1e-14);
711
712 items.push_back(true);
713 DLIB_TEST(average_precision(items) == 1);
714 DLIB_TEST(std::abs(average_precision(items,1) - 2.0/3.0) < 1e-14);
715
716 items.push_back(false);
717
718 DLIB_TEST(average_precision(items) == 1);
719 DLIB_TEST(std::abs(average_precision(items,1) - 2.0/3.0) < 1e-14);
720
721 items.push_back(true);
722
723 DLIB_TEST(std::abs(average_precision(items) - (2.0+3.0/4.0)/3.0) < 1e-14);
724
725 items.push_back(true);
726
727 DLIB_TEST(std::abs(average_precision(items) - (2.0 + 4.0/5.0 + 4.0/5.0)/4.0) < 1e-14);
728 DLIB_TEST(std::abs(average_precision(items,1) - (2.0 + 4.0/5.0 + 4.0/5.0)/5.0) < 1e-14);
729 }
730
731
732 template <typename sample_type>

Callers

nothing calls this directly

Calls 3

average_precisionFunction · 0.85
absFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected