Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
signatures-DF
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DOLPHINFREE experiments
signatures-DF
Commits
4bef0944
Commit
4bef0944
authored
4 months ago
by
Loïc Lehnhoff
Browse files
Options
Downloads
Patches
Plain Diff
more stats
parent
4315160d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Annex_WCT_analysis.ipynb
+589
-150
589 additions, 150 deletions
Annex_WCT_analysis.ipynb
WCT_analysis.ipynb
+104
-50
104 additions, 50 deletions
WCT_analysis.ipynb
WCT_analysis_utils.py
+19
-11
19 additions, 11 deletions
WCT_analysis_utils.py
with
712 additions
and
211 deletions
Annex_WCT_analysis.ipynb
+
589
−
150
View file @
4bef0944
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
WCT_analysis.ipynb
+
104
−
50
View file @
4bef0944
This diff is collapsed.
Click to expand it.
WCT_analysis_utils.py
+
19
−
11
View file @
4bef0944
...
@@ -747,7 +747,7 @@ def mandelbrot_law_fit(df):
...
@@ -747,7 +747,7 @@ def mandelbrot_law_fit(df):
def
vertical_proportion_plot
(
def
vertical_proportion_plot
(
df
,
xcol
,
hue
,
xorder
,
df
,
xcol
,
hue
,
xorder
,
legend_title
=
""
,
xlabel
=
""
,
ylabel
=
""
,
maintitle
=
""
,
legend_title
=
""
,
xlabel
=
""
,
ylabel
=
""
,
maintitle
=
""
,
palette
=
[
"
#648fff
"
,
"
#dc267f
"
,
"
#ffb000
"
]
palette
=
[
"
#648fff
"
,
"
#dc267f
"
,
"
#ffb000
"
]
,
show_sizes
=
True
):
):
if
len
(
xorder
)
>
0
:
if
len
(
xorder
)
>
0
:
...
@@ -769,6 +769,7 @@ def vertical_proportion_plot(
...
@@ -769,6 +769,7 @@ def vertical_proportion_plot(
# Add percentage labels to segments
# Add percentage labels to segments
for
i
,
state
in
enumerate
(
xorder
):
for
i
,
state
in
enumerate
(
xorder
):
if
show_sizes
:
axs
.
text
(
i
,
1
,
f
"
(N=
{
xvalue_sizes
[
i
]
}
)
"
,
axs
.
text
(
i
,
1
,
f
"
(N=
{
xvalue_sizes
[
i
]
}
)
"
,
ha
=
'
center
'
,
va
=
'
bottom
'
,
color
=
'
black
'
)
ha
=
'
center
'
,
va
=
'
bottom
'
,
color
=
'
black
'
)
...
@@ -809,7 +810,7 @@ def vertical_proportion_plot(
...
@@ -809,7 +810,7 @@ def vertical_proportion_plot(
def
horizontal_proportion_plot
(
def
horizontal_proportion_plot
(
df
,
ycol
,
hue
,
yorder
,
df
,
ycol
,
hue
,
yorder
,
legend_title
=
""
,
xlabel
=
""
,
ylabel
=
""
,
maintitle
=
""
,
legend_title
=
""
,
xlabel
=
""
,
ylabel
=
""
,
maintitle
=
""
,
palette
=
[
"
#648fff
"
,
"
#dc267f
"
,
"
#ffb000
"
]
palette
=
[
"
#648fff
"
,
"
#dc267f
"
,
"
#ffb000
"
]
,
show_sizes
=
True
):
):
if
len
(
yorder
)
>
0
:
if
len
(
yorder
)
>
0
:
...
@@ -831,6 +832,7 @@ def horizontal_proportion_plot(
...
@@ -831,6 +832,7 @@ def horizontal_proportion_plot(
# Add percentage labels to segments
# Add percentage labels to segments
for
i
,
state
in
enumerate
(
yorder
):
for
i
,
state
in
enumerate
(
yorder
):
if
show_sizes
:
axs
.
text
(
-
0.025
,
i
+
0.025
,
f
"
(N=
{
yvalue_sizes
[
i
]
}
)
"
,
axs
.
text
(
-
0.025
,
i
+
0.025
,
f
"
(N=
{
yvalue_sizes
[
i
]
}
)
"
,
ha
=
'
right
'
,
va
=
'
top
'
,
color
=
'
black
'
)
ha
=
'
right
'
,
va
=
'
top
'
,
color
=
'
black
'
)
...
@@ -869,7 +871,7 @@ def horizontal_proportion_plot(
...
@@ -869,7 +871,7 @@ def horizontal_proportion_plot(
fig
.
subplots_adjust
(
top
=
0.83
)
fig
.
subplots_adjust
(
top
=
0.83
)
return
fig
,
axs
return
fig
,
axs
def
fisher_tests
(
df
,
feature_col
,
feature_of_interest
,
group_col
,
alpha
=
0.05
):
def
fisher_tests
(
df
,
feature_col
,
feature_of_interest
,
group_col
,
alpha
=
0.05
,
get_values
=
False
):
"""
"""
Create a table showing proportions with letter annotations for significance groups.
Create a table showing proportions with letter annotations for significance groups.
...
@@ -900,6 +902,9 @@ def fisher_tests(df, feature_col, feature_of_interest, group_col, alpha=0.05):
...
@@ -900,6 +902,9 @@ def fisher_tests(df, feature_col, feature_of_interest, group_col, alpha=0.05):
n_groups
=
len
(
groups
)
n_groups
=
len
(
groups
)
# Matrix to store p-values between each pair of groups
# Matrix to store p-values between each pair of groups
if
get_values
:
p_values
=
pd
.
DataFrame
(
columns
=
[
"
mod_1
"
,
"
mod_2
"
,
"
reject_H0
"
,
"
p_value
"
,
"
odds_ratio
"
])
else
:
p_values
=
pd
.
DataFrame
(
columns
=
[
"
mod_1
"
,
"
mod_2
"
,
"
reject_H0
"
])
p_values
=
pd
.
DataFrame
(
columns
=
[
"
mod_1
"
,
"
mod_2
"
,
"
reject_H0
"
])
# Compute p-values for all pairs
# Compute p-values for all pairs
...
@@ -915,8 +920,11 @@ def fisher_tests(df, feature_col, feature_of_interest, group_col, alpha=0.05):
...
@@ -915,8 +920,11 @@ def fisher_tests(df, feature_col, feature_of_interest, group_col, alpha=0.05):
# Run Fisher's exact test
# Run Fisher's exact test
table
=
np
.
array
([[
sig1
,
non_sig1
],
[
sig2
,
non_sig2
]])
table
=
np
.
array
([[
sig1
,
non_sig1
],
[
sig2
,
non_sig2
]])
_
,
p_value
=
stats
.
fisher_exact
(
table
)
odds_ratio
,
p_value
=
stats
.
fisher_exact
(
table
)
if
get_values
:
p_values
.
loc
[
len
(
p_values
)]
=
[
g1
,
g2
,
p_value
<
alpha
,
p_value
,
odds_ratio
]
else
:
p_values
.
loc
[
len
(
p_values
)]
=
[
g1
,
g2
,
p_value
<
alpha
]
p_values
.
loc
[
len
(
p_values
)]
=
[
g1
,
g2
,
p_value
<
alpha
]
return
p_values
return
p_values
...
...
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