项目作者: sile

项目描述 :
A Rust implementation of fANOVA (functional analysis of variance)
高级语言: Rust
项目地址: git://github.com/sile/fanova.git
创建时间: 2020-05-17T16:25:22Z
项目社区:https://github.com/sile/fanova

开源协议:MIT License

下载


fanova

fanova
Documentation
Actions Status
Coverage Status
License: MIT

A Rust fANOVA (functional analysis of variance) implementation.

fANOVA provides a way to calculate feature importance.

Examples

  1. use fanova::{FanovaOptions, RandomForestOptions};
  2. use rand::{Rng, SeedableRng};
  3. let mut feature1 = Vec::new();
  4. let mut feature2 = Vec::new();
  5. let mut feature3 = Vec::new();
  6. let mut target = Vec::new();
  7. let mut rng = rand::rngs::StdRng::seed_from_u64(0);
  8. for _ in 0..100 {
  9. let f1 = rng.gen();
  10. let f2 = rng.gen();
  11. let f3 = rng.gen();
  12. let t = f1 + f2 * 2.0 + f3 * 3.0;
  13. feature1.push(f1);
  14. feature2.push(f2);
  15. feature3.push(f3);
  16. target.push(t);
  17. }
  18. let mut fanova = FanovaOptions::new()
  19. .random_forest(RandomForestOptions::new().seed(0))
  20. .fit(vec![&feature1, &feature2, &feature3], &target).unwrap();
  21. let importances = (0..3)
  22. .map(|i| fanova.quantify_importance(&[i]).mean)
  23. .collect::<Vec<_>>();
  24. assert_eq!(
  25. importances,
  26. vec![0.02744461966313835, 0.22991883769286145, 0.6288784011550144]
  27. );

References