Browse Source

[DATALAD] Recorded changes

Lucas Gautheron 3 weeks ago
parent
commit
8a674ef4e0

+ 5 - 6
code/models/blocks/confusion_model_binomial_hurdle_fast.stan

@@ -7,8 +7,7 @@ real confusion_model_lpdf(array[] matrix lambda,
     array[] int group,
     array[] real age,
     array[] real clip_duration,
-    matrix p,
-    real eta_voc
+    matrix p
 ) {
     real ll = 0;
     vector [4] dp;
@@ -31,7 +30,7 @@ real confusion_model_lpdf(array[] matrix lambda,
 
                 // chi_d is the latent amount of CHI vocalizations detected as i
                 for (chi_d in 0:(truth[k,1]>0?min(truth[k,1], algo[k,i]):0)) {
-                    dp[1] = truth[k,1]==0?0:beta_binomial_lpmf(chi_d | truth[k,1], lambda[lg,1,i]*eta_voc, (1-lambda[lg,1,i])*eta_voc);
+                    dp[1] = truth[k,1]==0?0:binomial_lpmf(chi_d | truth[k,1], lambda[lg,1,i]);
                     // chi1 is the amount of those vocalizations that result in only one voc i
                     // (as opposed to two vocs)
                     for (chi1 in max(0, 2*chi_d-algo[k,i]):chi_d) {
@@ -39,19 +38,19 @@ real confusion_model_lpdf(array[] matrix lambda,
                         bp[1] = chi_d==0?0:binomial_lpmf(chi1 | chi_d, p[1,i]);
 
                         for (och_d in 0:(truth[k,2]>0?min(truth[k,2], algo[k,i]-chi):0)) {
-                            dp[2] = truth[k,2]==0?0:beta_binomial_lpmf(och_d | truth[k,2], lambda[lg,2,i]*eta_voc, (1-lambda[lg,2,i])*eta_voc);
+                            dp[2] = truth[k,2]==0?0:binomial_lpmf(och_d | truth[k,2], lambda[lg,2,i]);
                             for (och1 in max(0, 2*och_d-(algo[k,i]-chi)):och_d) {
                                 int och = 2*och_d-och1;
                                 bp[2] = och_d==0?0:binomial_lpmf(och1 | och_d, p[2,i]);
 
                                 for (fem_d in 0:(truth[k,3]>0?min(truth[k,3], algo[k,i]-chi-och):0)) {
-                                    dp[3] = truth[k,3]==0?0:beta_binomial_lpmf(fem_d | truth[k,3], lambda[lg,3,i]*eta_voc, (1-lambda[lg,3,i])*eta_voc);
+                                    dp[3] = truth[k,3]==0?0:binomial_lpmf(fem_d | truth[k,3], lambda[lg,3,i]);
                                     for (fem1 in max(0, 2*fem_d-(algo[k,i]-chi-och)):fem_d) {
                                         int fem = 2*fem_d-fem1;
                                         bp[3] = fem_d==0?0:binomial_lpmf(fem1 | fem_d, p[3,i]);
 
                                         for (mal_d in 0:(truth[k,4]>0?min(truth[k,4], algo[k,i]-chi-och-fem):0)) {
-                                            dp[4] = truth[k,4]==0?0:beta_binomial_lpmf(mal_d | truth[k,4], lambda[lg,4,i]*eta_voc, (1-lambda[lg,4,i])*eta_voc);
+                                            dp[4] = truth[k,4]==0?0:binomial_lpmf(mal_d | truth[k,4], lambda[lg,4,i]);
                                             for (mal1 in max(0, 2*mal_d-(algo[k,i]-chi-och-fem)):mal_d) {
                                                 int mal = 2*mal_d-mal1;
                                                 int delta = algo[k,i] - (mal+fem+och+chi);

+ 0 - 1
code/models/blocks/confusion_model_parameters_binomial_hurdle.stan

@@ -1,5 +1,4 @@
 matrix<lower=2>[n_classes,n_classes] etas;
-real<lower=2> eta_voc;
 matrix<lower=0,upper=1>[n_classes,n_classes] mus;
 array [n_groups] matrix<lower=0,upper=1>[n_classes,n_classes] lambda;
 matrix<lower=0,upper=1>[n_classes,n_classes] p;

+ 1 - 2
code/models/blocks/confusion_model_priors_binomial_hurdle.stan

@@ -1,4 +1,3 @@
-eta_voc ~ pareto(2, 2);
 for (i in 1:n_classes) {
     p[i] ~ beta(3,1);
     mus[i] ~ uniform(0, 1);
@@ -11,5 +10,5 @@ for (c in 1:n_groups) {
         ll_normal += beta_proportion_lpdf(lambda[c,i,:] | mus[i,:], etas[i,:]);
     }
     // regularization of OOD outliers.
-    target += log_mix(0.01, 0, ll_normal);
+    target += log_mix(0.025, 0, ll_normal);
 }

+ 1 - 1
code/models/dev_siblings_binomial_hurdle_fast.stan

@@ -116,7 +116,7 @@ model {
         confusion_model_lpdf, lambda, 1,
         n_classes, n_clips,
         algo_total, truth_total, group, clip_duration, clip_age,
-        p, eta_voc//, lambda_fp
+        p//, lambda_fp
     );
 
     // priors on the nuisance parameters of the confusion model