File: transform.c

package info (click to toggle)
apophenia 1.0%2Bds-7
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 2,904 kB
  • sloc: ansic: 19,479; makefile: 374; awk: 124; sh: 105; sed: 32
file content (30 lines) | stat: -rw-r--r-- 903 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <apop.h>

// For defining the bounds the data-constraining function
// needs to enforce.
double greater_than_zero(apop_data *d, apop_model *m){
    return apop_data_get(d) > 0;
}

int main(){
    apop_model_print (
        apop_estimate(
             apop_update(
                apop_model_draws(
                    apop_model_mixture(
                        apop_model_set_parameters(apop_poisson, 2.8),
                        apop_model_set_parameters(apop_poisson, 2.0),
                        apop_model_set_parameters(apop_poisson, 1.3)
                    ), 
                    1e4
                ),
                apop_model_dconstrain(
                    .base_model=apop_model_set_parameters(apop_normal, 2, 1), 
                    .constraint=greater_than_zero
                ),
                apop_poisson
            )->data,
            apop_normal
        )
    );
}