Adds automatic output saving

This commit is contained in:
Daniel Svitan 2024-12-23 18:08:18 +01:00
parent 29ab473c3c
commit 6831e847ff
4 changed files with 28 additions and 12 deletions

View File

@ -3,6 +3,7 @@ import argparse
import numpy as np
import scipy.stats as stats
import scikit_posthocs as sp
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
@ -38,8 +39,10 @@ def analyze(name: str, data: List[np.ndarray]):
return F, p
print("statistically significant")
tukey_results = stats.tukey_hsd(*filtered_data)
print(tukey_results)
#tukey_results = stats.tukey_hsd(*filtered_data)
#print(tukey_results)
ps = sp.posthoc_dunn(filtered_data, val_col='Values', group_col='Group', p_adjust='bonferroni')
print(ps)
return F, p

View File

@ -1,10 +1,19 @@
#!/usr/bin/bash
./venv/bin/python3 distribution.py --graph --save
./venv/bin/python3 analyze_sex.py --graph --save "Figure_13.png"
./venv/bin/python3 analyze_ses.py --graph --save "Figure_14.png"
./venv/bin/python3 analyze_occupation.py --graph --save "Figure_15.png"
./venv/bin/python3 analyze_living.py --graph --save "Figure_16.png"
./venv/bin/python3 analyze_commute.py --graph --save "Figure_17.png"
./venv/bin/python3 analyze_sleep.py --graph --save "Figure_18.png"
./venv/bin/python3 analyze_absence.py --graph --save "Figure_19.png"
find results ! -name 'train.txt' -type f -exec rm -f {} +
./venv/bin/python3 distribution.py --graph --save | tee results/distribution.txt
echo -e "\n\n\n\n"
./venv/bin/python3 analyze_sex.py --graph --save "results/Figure_13.png" | tee results/sex.txt
echo -e "\n\n\n\n"
./venv/bin/python3 analyze_ses.py --graph --save "results/Figure_14.png" | tee results/ses.txt
echo -e "\n\n\n\n"
./venv/bin/python3 analyze_occupation.py --graph --save "results/Figure_15.png" | tee results/occupation.txt
echo -e "\n\n\n\n"
./venv/bin/python3 analyze_living.py --graph --save "results/Figure_16.png" | tee results/living.txt
echo -e "\n\n\n\n"
./venv/bin/python3 analyze_commute.py --graph --save "results/Figure_17.png" | tee results/commute.txt
echo -e "\n\n\n\n"
./venv/bin/python3 analyze_sleep.py --graph --save "results/Figure_18.png" | tee results/sleep.txt
echo -e "\n\n\n\n"
./venv/bin/python3 analyze_absence.py --graph --save "results/Figure_19.png" | tee results/absence.txt

View File

@ -40,7 +40,7 @@ def plot_pie(data, labels, title, explode=None):
plt.tight_layout()
if save:
plt.savefig(f"Figure_{graph_index}.png")
plt.savefig(f"results/Figure_{graph_index}.png")
graph_index += 1
else:
plt.show()
@ -59,7 +59,7 @@ def plot_hist(data, title, xlabel, ylabel):
plt.tight_layout()
if save:
plt.savefig(f"Figure_{graph_index}.png")
plt.savefig(f"results/Figure_{graph_index}.png")
graph_index += 1
else:
plt.show()

View File

@ -25,14 +25,18 @@ nvidia-nvjitlink-cu12==12.4.127
nvidia-nvtx-cu12==12.4.127
packaging==24.2
pandas==2.2.3
patsy==1.0.1
pillow==11.0.0
pyparsing==3.2.0
python-dateutil==2.9.0.post0
pytz==2024.2
scikit-learn==1.6.0
scikit-posthocs==0.11.2
scipy==1.14.1
seaborn==0.13.2
setuptools==75.6.0
six==1.17.0
statsmodels==0.14.4
sympy==1.13.1
threadpoolctl==3.5.0
torch==2.5.1