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

Method perform_test

dlib/test/find_optimal_parameters.cpp:30–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28 {}
29
30 void perform_test (
31 )
32 {
33 print_spinner();
34 matrix<double,0,1> params = {0.5, 0.5};
35 dlib::find_optimal_parameters(4, 0.001, 100, params, {-0.1, -0.01}, {5, 5}, [](const matrix<double,0,1>& params) {
36 cout << ".";
37 return sum(squared(params));
38 });
39
40 matrix<double,0,1> true_params = {0,0};
41
42 DLIB_TEST(max(abs(true_params - params)) < 1e-10);
43
44 params = {0.1};
45 dlib::find_optimal_parameters(4, 0.001, 100, params, {-0.01}, {5}, [](const matrix<double,0,1>& params) {
46 cout << ".";
47 return sum(squared(params));
48 });
49
50 true_params = {0};
51 DLIB_TEST(max(abs(true_params - params)) < 1e-10);
52 }
53 } a;
54
55}

Callers

nothing calls this directly

Calls 6

print_spinnerFunction · 0.85
squaredFunction · 0.85
absFunction · 0.85
sumFunction · 0.50
maxFunction · 0.50

Tested by

no test coverage detected