Martin Horvat 11 месяцев назад
Родитель
Сommit
de8f844d8e
1 измененных файлов с 8 добавлено и 5 удалено
  1. 8 5
      python/bayesian/Bayesian_Zahra_v1.1.py

+ 8 - 5
python/bayesian/Bayesian_Zahra_v1.1.py

@@ -4,10 +4,13 @@ import matplotlib.pyplot as plt
 from scipy import optimize
 from scipy.special import betaln, gammaln
 import scipy.io as io
+import os
 
-data_path = "../../data/"
-suv   = io.loadmat(data_path + "suv_percentilesSLOthenUWM.mat")['lung_SUVperc_COMBINED'][0:58, :, :]
-flags = io.loadmat(data_path + "flags_combined.mat")['flags'][0:58, 3]   # 0=NC, 1=AE
+# determine git root
+root = os.popen("git rev-parse --show-toplevel").read().strip()
+
+suv   = io.loadmat(os.path.join(root, "data", "suv_percentilesSLOthenUWM.mat"))['lung_SUVperc_COMBINED'][0:58, :, :]
+flags = io.loadmat(os.path.join(root, "data", "flags_combined.mat"))['flags'][0:58, 3]   # 0=NC, 1=AE
 
 # Feature X = max SUV_94 per subject; label y = flags
 X = np.nanmax(suv[:, :, 94], axis=1).astype(float).ravel()
@@ -69,8 +72,8 @@ TAU = 25.0                                   # shrink toward empirical AE rate
 alpha = max(TAU * p_emp, 1e-6)
 beta  = max(TAU * (1.0 - p_emp), 1e-6)
 
-#prior_r = None
-prior_r = (1.01, 1.01)
+prior_r = None
+#prior_r = (1.01, 1.01)
 #prior_r = (3, 3)
 
 # Objective: negative log-posterior (likelihood + Beta prior on p)