-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove docs from .gitignore and add to Git
- Loading branch information
1 parent
751bcc9
commit 30a9b27
Showing
21 changed files
with
215 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# CPM Regression | ||
|
||
::: cpm.cpm_analysis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Edge Selection | ||
|
||
::: cpm.edge_selection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Fold | ||
|
||
::: cpm.fold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Predictive Models | ||
|
||
::: cpm.models |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```python | ||
--8<-- "examples/hcp_analysis.py" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```python | ||
--8<-- "examples/example_simulated_data.py" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
:root { | ||
--md-primary-fg-color: #257180; | ||
--md-primary-fg-color--light: #257180; | ||
--md-primary-fg-color--dark: #257180; | ||
--md-accent-fg-color: #FD8B51; | ||
--md-accent-fg-color--transparent: #FD8B51; | ||
--md-accent-bg-color: #FD8B51; | ||
--md-accent-bg-color--light: #FD8B51; | ||
} | ||
:root > * { | ||
--md-code-bg-color: rgb(242, 229, 191, 0.3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from sklearn.model_selection import KFold, ShuffleSplit, RepeatedKFold | ||
|
||
from cpm import CPMRegression | ||
from cpm.simulate_data import simulate_regression_data_2 | ||
from cpm.edge_selection import PThreshold, UnivariateEdgeSelection | ||
|
||
|
||
link_types = ['no_link', | ||
'no_no_link', | ||
'direct_link', | ||
'weak_link' | ||
] | ||
edge_statistics = ['pearson', 'pearson_partial'] | ||
results_folder = '/spm-data/vault-data3/mmll/projects/confound_corrected_cpm/results' | ||
|
||
for link in link_types: | ||
for edge_statistic in edge_statistics: | ||
X, y, covariates = simulate_regression_data_2(n_features=1225, n_informative_features=50, link_type=link) | ||
|
||
univariate_edge_selection = UnivariateEdgeSelection(edge_statistic=[edge_statistic], | ||
edge_selection=[PThreshold(threshold=[0.05], | ||
correction=['fdr_by'])]) | ||
cpm = CPMRegression(results_directory=f'{results_folder}/simulated_data_{link}_{edge_statistic}', | ||
cv=RepeatedKFold(n_splits=10, n_repeats=5, random_state=42), | ||
edge_selection=univariate_edge_selection, | ||
inner_cv=ShuffleSplit(n_splits=3, test_size=0.2, random_state=42), | ||
add_edge_filter=True, | ||
n_permutations=2) | ||
cpm.estimate(X=X, y=y, covariates=covariates) | ||
|
||
#cpm._calculate_permutation_results('./tmp/example_simulated_data2') | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import os | ||
|
||
import seaborn as sns | ||
import matplotlib.pyplot as plt | ||
import pandas as pd | ||
|
||
|
||
results_folder = "simulated_data" | ||
edge_statistics = ['pearson', 'pearson_partial'] | ||
|
||
|
||
for scenario in ['A', 'B']: | ||
for edge_statistic in edge_statistics: | ||
results = {f"scenario_{scenario}1": os.path.join(results_folder, f"scenario_{scenario}1", "results", edge_statistic), | ||
f"scenario_{scenario}2": os.path.join(results_folder, f"scenario_{scenario}2", "results", edge_statistic), | ||
f"scenario_{scenario}3": os.path.join(results_folder, f"scenario_{scenario}3", "results", edge_statistic), | ||
f"scenario_{scenario}4": os.path.join(results_folder, f"scenario_{scenario}4", "results", edge_statistic), | ||
} | ||
|
||
dfs = [] | ||
for link_type, folder in results.items(): | ||
df = pd.read_csv(os.path.join(folder, 'cv_results.csv')) | ||
df['link_type'] = link_type | ||
dfs.append(df) | ||
|
||
concatenated_df = pd.concat(dfs, ignore_index=True) | ||
|
||
concatenated_df = concatenated_df[concatenated_df['network'] == 'both'] | ||
|
||
|
||
g = sns.FacetGrid(concatenated_df, col="link_type", margin_titles=True, despine=True, | ||
height=2.5, hue="model") | ||
g.map(plt.axvline, x=0, color='grey', linewidth=0.5, zorder=-1) | ||
g.map(sns.violinplot, "pearson_score", "model", inner=None, split=True,# hue="model",# hue_order=[1, 2], | ||
density_norm='count', dodge=True, palette="Blues_r", fill=True) | ||
#g.map(sns.boxplot, "pearson_score", "model", dodge=True, #hue=1, hue_order=[2, 1] | ||
# ) | ||
g.set_titles(col_template="{col_name}", size=7) | ||
g.set_xlabels("Pearson correlation", size=8) | ||
plt.suptitle(edge_statistic) | ||
plt.show() | ||
print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.