Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
deepdraw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
medai
software
deepdraw
Commits
7802eab3
Commit
7802eab3
authored
4 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[test.test_cli] Improve unit tests for significance script
parent
c2ad2952
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#41340
passed
4 years ago
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/ip/binseg/engine/significance.py
+25
-19
25 additions, 19 deletions
bob/ip/binseg/engine/significance.py
bob/ip/binseg/test/test_cli.py
+4
-3
4 additions, 3 deletions
bob/ip/binseg/test/test_cli.py
with
29 additions
and
22 deletions
bob/ip/binseg/engine/significance.py
+
25
−
19
View file @
7802eab3
...
@@ -6,6 +6,9 @@ import itertools
...
@@ -6,6 +6,9 @@ import itertools
import
textwrap
import
textwrap
import
multiprocessing
import
multiprocessing
import
logging
logger
=
logging
.
getLogger
(
__name__
)
import
h5py
import
h5py
from
tqdm
import
tqdm
from
tqdm
import
tqdm
import
numpy
import
numpy
...
@@ -806,31 +809,34 @@ def write_analysis_text(names, da, db, f):
...
@@ -806,31 +809,34 @@ def write_analysis_text(names, da, db, f):
# * The dependent variable should be approximately normally distributed. [!!!]
# * The dependent variable should be approximately normally distributed. [!!!]
# * The dependent variable should not contain any outliers. [OK]
# * The dependent variable should not contain any outliers. [OK]
f
.
write
(
"
\n
Paired Significance Tests:
\n
"
)
if
(
diff
==
0.0
).
all
():
logger
.
error
(
"
Differences are exactly zero between both
"
"
patch distributions, for **all** samples. Statistical
"
"
significance tests are not meaningful in this context and
"
"
will be skipped. This typically indicates an issue with
"
"
the setup of prediction folders (duplicated?)
"
)
return
f
.
write
(
"
\n
Paired significance tests:
\n
"
)
w
,
p
=
scipy
.
stats
.
ttest_rel
(
da
,
db
)
w
,
p
=
scipy
.
stats
.
ttest_rel
(
da
,
db
)
f
.
write
(
f
"
* Paired T (H0: same distro): S =
{
w
:
g
}
, p =
{
p
:
.
5
f
}
\n
"
)
f
.
write
(
f
"
* Paired T (H0: same distro): S =
{
w
:
g
}
, p =
{
p
:
.
5
f
}
\n
"
)
try
:
f
.
write
(
"
* Wilcoxon:
\n
"
)
f
.
write
(
"
* Wilcoxon:
\n
"
)
w
,
p
=
scipy
.
stats
.
wilcoxon
(
diff
)
w
,
p
=
scipy
.
stats
.
wilcoxon
(
diff
)
f
.
write
(
f
"
* H0 = same distro: W =
{
w
:
g
}
, p =
{
p
:
.
5
f
}
\n
"
)
f
.
write
(
f
"
* H0 = same distro: W =
{
w
:
g
}
, p =
{
p
:
.
5
f
}
\n
"
)
w
,
p
=
scipy
.
stats
.
wilcoxon
(
diff
,
alternative
=
"
greater
"
)
w
,
p
=
scipy
.
stats
.
wilcoxon
(
diff
,
alternative
=
"
greater
"
)
f
.
write
(
f
.
write
(
f
"
* H0 = med(
{
names
[
0
]
}
) < med(
{
names
[
1
]
}
):
"
f
"
* H0 = med(
{
names
[
0
]
}
) < med(
{
names
[
1
]
}
):
"
f
"
W =
{
w
:
g
}
, p =
{
p
:
.
5
f
}
\n
"
f
"
W =
{
w
:
g
}
, p =
{
p
:
.
5
f
}
\n
"
)
)
w
,
p
=
scipy
.
stats
.
wilcoxon
(
diff
,
alternative
=
"
less
"
)
w
,
p
=
scipy
.
stats
.
wilcoxon
(
diff
,
alternative
=
"
less
"
)
f
.
write
(
f
.
write
(
f
"
* H0 = med(
{
names
[
0
]
}
) > med(
{
names
[
1
]
}
):
"
f
"
* H0 = med(
{
names
[
0
]
}
) > med(
{
names
[
1
]
}
):
"
f
"
W =
{
w
:
g
}
, p =
{
p
:
.
5
f
}
\n
"
f
"
W =
{
w
:
g
}
, p =
{
p
:
.
5
f
}
\n
"
)
)
except
ValueError
as
e
:
f
.
write
(
f
"
ERROR: Differences are exactly zero between both
"
f
"
patch distributions. The Wilcoxon test does not work in
"
f
"
these conditions (review your prediction directories):
{
e
}
\n
"
)
def
write_analysis_figures
(
names
,
da
,
db
,
fname
):
def
write_analysis_figures
(
names
,
da
,
db
,
fname
):
...
...
This diff is collapsed.
Click to expand it.
bob/ip/binseg/test/test_cli.py
+
4
−
3
View file @
7802eab3
...
@@ -568,9 +568,10 @@ def _check_significance(runner):
...
@@ -568,9 +568,10 @@ def _check_significance(runner):
keywords
=
{
keywords
=
{
r
"
^Evaluating patch
'
accuracy
'
on
"
:
2
,
r
"
^Evaluating patch
'
accuracy
'
on
"
:
2
,
r
"
^Evaluating patch
'
accuracy
'
differences on
"
:
1
,
r
"
^Evaluating patch
'
accuracy
'
differences on
"
:
1
,
r
"
^#Samples/Median/Avg/Std.Dev.
"
:
1
,
#r"^Basic statistics from distributions:$": 1,
r
"
^Paired T-test
"
:
1
,
r
"
^Writing analysis figures
"
:
1
,
r
"
^Wilcoxon test
"
:
3
,
r
"
^Writing analysis summary
"
:
1
,
r
"
^Differences are exactly zero
"
:
2
,
}
}
buf
.
seek
(
0
)
buf
.
seek
(
0
)
logging_output
=
buf
.
read
()
logging_output
=
buf
.
read
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment