Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
a61a03fa
"...graphbolt/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "2968c9b247314dcb0ff64d00416654e99ca01de7"
Commit
a61a03fa
authored
Feb 14, 2013
by
Davis King
Browse files
Added tests for average_precision()
parent
d102f69a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
dlib/test/statistics.cpp
dlib/test/statistics.cpp
+25
-0
No files found.
dlib/test/statistics.cpp
View file @
a61a03fa
...
@@ -340,6 +340,30 @@ namespace
...
@@ -340,6 +340,30 @@ namespace
DLIB_TEST
(
rs1
.
max_n
()
==
50
);
DLIB_TEST
(
rs1
.
max_n
()
==
50
);
}
}
void
test_average_precision
()
{
std
::
vector
<
bool
>
items
;
DLIB_TEST
(
average_precision
(
items
)
==
1
);
DLIB_TEST
(
average_precision
(
items
,
1
)
==
0
);
items
.
push_back
(
true
);
DLIB_TEST
(
average_precision
(
items
)
==
1
);
DLIB_TEST
(
std
::
abs
(
average_precision
(
items
,
1
)
-
0.5
)
<
1e-14
);
items
.
push_back
(
true
);
DLIB_TEST
(
average_precision
(
items
)
==
1
);
DLIB_TEST
(
std
::
abs
(
average_precision
(
items
,
1
)
-
2.0
/
3.0
)
<
1e-14
);
items
.
push_back
(
false
);
DLIB_TEST
(
average_precision
(
items
)
==
1
);
DLIB_TEST
(
std
::
abs
(
average_precision
(
items
,
1
)
-
2.0
/
3.0
)
<
1e-14
);
items
.
push_back
(
true
);
DLIB_TEST
(
std
::
abs
(
average_precision
(
items
)
-
(
2.0
+
3.0
/
4.0
)
/
3.0
)
<
1e-14
);
}
void
perform_test
(
void
perform_test
(
)
)
{
{
...
@@ -350,6 +374,7 @@ namespace
...
@@ -350,6 +374,7 @@ namespace
test_randomize_samples
();
test_randomize_samples
();
test_randomize_samples2
();
test_randomize_samples2
();
another_test
();
another_test
();
test_average_precision
();
}
}
}
a
;
}
a
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment