posteriors_adu.stan 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // TODO
  2. // use speech rates to set priors on truth_vocs
  3. data {
  4. int<lower=1> n_classes; // number of classes
  5. // analysis data block
  6. int<lower=1> n_recs;
  7. int<lower=1> n_children;
  8. array[n_recs] int<lower=1> children;
  9. array[n_recs] real<lower=1> age;
  10. array[n_recs] int<lower=-1> siblings;
  11. array[n_children] int<lower=1> corpus;
  12. real<lower=0> recs_duration;
  13. // speaker confusion data block
  14. int<lower=1> n_clips; // number of clips
  15. int<lower=1> n_groups; // number of groups
  16. int<lower=1> n_corpora;
  17. int<lower=0> n_validation;
  18. // actual speech rates
  19. int<lower=1> n_rates;
  20. int<lower=1> n_speech_rate_children;
  21. array [n_rates,n_classes] int<lower=0> speech_rates;
  22. array [n_rates] int group_corpus;
  23. vector<lower=0>[n_rates] durations;
  24. array [n_rates] real<lower=0> speech_rate_age;
  25. array [n_rates] int<lower=-1> speech_rate_siblings;
  26. array [n_rates] int<lower=1,upper=n_speech_rate_children> speech_rate_child;
  27. // parallel processing
  28. int<lower=1> threads;
  29. }
  30. transformed data {
  31. array[n_speech_rate_children] int<lower=1> speech_rate_child_corpus;
  32. array[n_children] int<lower=-1> child_siblings;
  33. array[n_speech_rate_children] int<lower=-1> speech_rate_child_siblings;
  34. int no_siblings = 0;
  35. int has_siblings = 0;
  36. for (k in 1:n_rates) {
  37. speech_rate_child_corpus[speech_rate_child[k]] = group_corpus[k];
  38. }
  39. for (k in 1:n_recs) {
  40. child_siblings[children[k]] = siblings[k];
  41. }
  42. for (c in 1:n_children) {
  43. if (child_siblings[c] == 0) {
  44. no_siblings += 1;
  45. }
  46. else if (child_siblings[c] > 0) {
  47. has_siblings += 1;
  48. }
  49. }
  50. for (k in 1:n_rates) {
  51. speech_rate_child_siblings[speech_rate_child[k]] = speech_rate_siblings[k];
  52. }
  53. }
  54. parameters {
  55. #include "blocks/behavior_model_parameters_adu.stan"
  56. #include "blocks/human_annotations_parameters_adu.stan"
  57. }
  58. model {
  59. //actual model
  60. #include "blocks/behavior_model_priors_adu.stan"
  61. #include "blocks/human_annotations_adu.stan"
  62. }