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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// use csv::Trim;
// use num_traits::{Float, real::Real};
// pub trait Statistic<D, T> {
// fn compute(&self, data: &D) -> T;
// }
// trait JeffreysPrior<D, F> {
// fn log_jeffreys(&self, data: &D) -> F;
// }
// trait LogPosterior<D, F> {
// fn logp(&self, data: &D) -> F;
// }
// impl<T, D, F> LogPosterior<D, F> for T
// where
// T: Statistic<D, F> + JeffreysPrior<D, F>,
// F: Float,
// {
// fn logp(&self, data: &D) -> F {
// self.compute(data) + self.log_jeffreys(data)
// }
// }
// struct Estimator<Model>
// where
// Model: Statistic<P, D>
// {
// model: Model,
// data: D,
// }
// impl Estimator {
// self.data
// .iter()
// .map(|v| f.compute())
// }
// struct ExpFit {
// a: f32,
// b: f32,
// }
// impl Statistic<f32, f32> for ExpFit {
// fn compute(&self, data: f32) -> f32 {
// (-data*self.b).exp()*a
// }
// }
// impl JeffreysPrior for ExpFit {
// fn logp(&self) -> f32 {
// -self.a.log2()
// }
// }