gammatest

Crates.iogammatest
lib.rsgammatest
version0.1.21
sourcesrc
created_at2022-08-14 13:30:01.276454
updated_at2022-08-14 14:44:25.252546
descriptiongammatest crate provides a code to perform Gamma Test for machine learning feature selection.
homepage
repository
max_upload_size
id645422
size20,644
SaadD (SaadDAHMANI)

documentation

README

gammatest

Definition

gammatest is a simple rust implementation of the Gamma Test.

Gamma Test [1] is non-parametric test for feature selection frequently used in machine learning.

The gammatest crate is based on the paper [2].

References

[1] Stefánsson, A., Končar, N., & Jones, A. J. (1997). A note on the gamma test. Neural Computing & Applications, 5(3), 131-133.

[2] Kemp, S. E., Wilson, I. D., & Ware, J. A. (2004). A tutorial on the gamma test. International Journal of Simulation: Systems, Science and Technology, 6(1-2), 67-75.

Example

use gammatest::*;
   
fn main()
   {    
      // Give the input matrix
      let inputs =[
                  [3.0f32, 4.0, 4.0].to_vec(),
                  [2.0f32, 1.0, 3.0].to_vec(),
                  [1.0f32, 0.0, 1.0].to_vec(),
                  [1.0f32, 1.0, 1.0].to_vec(),
               ];

      // Give the output vector 
      let output = [54.0f32, 30.0, 3.0, 28.0];
      
      // p is the number of neighbors 
      let p : usize = 3;
      
      // Build the GammaTest using f32 data type
      let mut gt : GammaTest<f32> = GammaTest::new(&inputs, &output, p);
      
      // To use f64 data type 
      //let mut gt : GammaTest<f64> = GammaTest::new(&inputs, &output, p);

      // Call function compute() to compute GammaTest parameters.
      gt.compute();

      // Check results
      assert_eq!(gt.slope,  Some(33.54095));
      assert_eq!(gt.intercept, Some(20.578278));
    } 

Current development state

In the current version, gammatest uses the "Brute force approach" to sort k-near neighbors, which is a simple but slow method comparing to some others.

Commit count: 0

cargo fmt