pub struct GammaTest<'a, T: Float> {
    pub intercept: Option<T>,
    pub slope: Option<T>,
    pub v_ratio: Option<T>,
    pub p: usize,
    pub output_variance: Option<T>,
    pub sigmas: Option<Vec<T>>,
    pub deltas: Option<Vec<T>>,
    pub inputs: &'a [Vec<T>],
    pub outputs: &'a [T],
    pub euclidean_distance_table: Vec<Vec<T>>,
    pub y_distance_table: Vec<Vec<T>>,
    pub near_neighbor_table: Vec<Vec<T>>,
    /* private fields */
}
Expand description

GammaTest struct computes Gamma Test for a given (inputs/outputs) dataset in lazy way.

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));
    } 

Fields

intercept: Option<T>

The Gamma parameter (intercept)

slope: Option<T>

The slope value

v_ratio: Option<T>

The V_ratio value

p: usize

The number of neighbors

output_variance: Option<T>sigmas: Option<Vec<T>>deltas: Option<Vec<T>>inputs: &'a [Vec<T>]outputs: &'a [T]euclidean_distance_table: Vec<Vec<T>>y_distance_table: Vec<Vec<T>>near_neighbor_table: Vec<Vec<T>>

Implementations

Build a new Gammatest object. “p” in number of neighbors. #Panics The code panics if :

  1. inputs/outputs length is null (i.e., if no elements in the dataset),
  2. inputs lenght not equals outputs length,
  3. number of neighbors p is less than 2.

Call this function to compute Gamma Test values (Slope, Intercep and V_ratio).

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.