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
57
58
59
//! A Rust [fANOVA] (functional analysis of variance) implementation.
//!
//! fANOVA provides a way to calculate feature importance.
//!
//! # Examples
//!
//! ```
//! use fanova::{FanovaOptions, RandomForestOptions};
//! use rand::{RngExt, SeedableRng};
//!
//! let mut feature1 = Vec::new();
//! let mut feature2 = Vec::new();
//! let mut feature3 = Vec::new();
//! let mut target = Vec::new();
//!
//! let mut rng = rand::rngs::StdRng::seed_from_u64(0);
//! for _ in 0..100 {
//! let f1 = rng.random();
//! let f2 = rng.random();
//! let f3 = rng.random();
//! let t = f1 + f2 * 2.0 + f3 * 3.0;
//!
//! feature1.push(f1);
//! feature2.push(f2);
//! feature3.push(f3);
//! target.push(t);
//! }
//!
//! let mut fanova = FanovaOptions::new()
//! .random_forest(RandomForestOptions::new().seed(0))
//! .fit(vec![&feature1, &feature2, &feature3], &target).unwrap();
//! let importances = (0..3)
//! .map(|i| fanova.quantify_importance(&[i]).mean)
//! .collect::<Vec<_>>();
//!
//! assert_eq!(
//! importances,
//! vec![0.03949614161205558, 0.24001507447005044, 0.5934922097988682]
//! );
//! ```
//!
//! # References
//!
//! - [An Efficient Approach for Assessing Hyperparameter Importance][fANOVA]
//!
//! [fANOVA]: http://proceedings.mlr.press/v32/hutter14.html
//!
pub use ;
pub use RandomForestOptions;