be.ac.ulb.mlg.utils
Class Measurer

java.lang.Object
  extended by be.ac.ulb.mlg.utils.Measurer

public class Measurer
extends Object


Field Summary
static Renormalizer NO_RENORMALIZER
          Constant value meaning NO RENORMALIZATION PROCESS
 
Constructor Summary
Measurer()
          Construct a Measurer trying native, no missing value and no renormalization without any shuffle
Measurer(boolean useNative, int maxMissingValues, Renormalizer renormalizer)
          Construct a Measurer trying native without any shuffle
Measurer(int maxMissingValues)
          Construct a Measurer trying native without any shuffle and without renormalization
 
Method Summary
static int fillMissing(boolean[] computable, double[] a, double[] b)
          Fill computable array of boolean true iff a OR b contains a missing value
 int getMaximumMissingValues()
          Know the maximum number of missing values
 int getNumberOfThreads()
          Know the current number of threads to be used
 Renormalizer getRenormalizer()
          Retrieve the renormalizer object
static boolean hasNativeSupport()
          Know if the native implementation is available
 boolean isHandelingMissingValues()
          Know if the measurer object must take care of missing values
 boolean isUsingNative()
          Know if the current measurer try to use the native implementation
 boolean isUsingShuffling()
          Know the shuffling usage
 Map<Measure,double[][]> measure(double[][] input, Measure[] measures)
          Compute the given measures on data without ignored pairs
 Map<Measure,double[][]> measure(double[][] input, Measure[] measures, boolean[][] measurable)
          Compute the given measures on data
 Map<Measure,double[][]> measure(cern.colt.matrix.DoubleMatrix2D input, Measure[] measures)
          Compute the given measures on data without ignored pairs
 Map<Measure,double[][]> measure(cern.colt.matrix.DoubleMatrix2D input, Measure[] measures, boolean[][] measurable)
          Compute the given measures on data
 boolean preShuffle()
          Know if the renormalizer use pre-shuffle
 void setHandelingMissingValues(boolean handleMissingValues)
          Define the checking of missing values
 void setMaximumMissingValues(int maxMissingValues)
          Define the number of maximum allowed missing values
 void setNumberOfThreads(int nThreads)
          Define the number of threads to be used
 void setRenormalizer(Renormalizer renormalizer)
          Define the renormalizer object
 void useNative(boolean useNative)
          Define the usage of the native implementation
 void usePreShuffle(boolean shuffle)
          Enable or disable pre-shuffle of data
 void useShuffling(boolean useShuffling)
          Change the usage of shuffle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_RENORMALIZER

public static final Renormalizer NO_RENORMALIZER
Constant value meaning NO RENORMALIZATION PROCESS

Constructor Detail

Measurer

public Measurer()
Construct a Measurer trying native, no missing value and no renormalization without any shuffle


Measurer

public Measurer(int maxMissingValues)
Construct a Measurer trying native without any shuffle and without renormalization

Parameters:
maxMissingValues - The number of maximum allowed missing values

Measurer

public Measurer(boolean useNative,
                int maxMissingValues,
                Renormalizer renormalizer)
Construct a Measurer trying native without any shuffle

Parameters:
useNative - Boolean to try the usage of the native implementation
maxMissingValues - The number of maximum allowed missing values
renormalizer - The renormalizer object
Method Detail

useShuffling

public void useShuffling(boolean useShuffling)
Change the usage of shuffle

Parameters:
useShuffling - new shuffling usage: true for shuffling

isUsingShuffling

public boolean isUsingShuffling()
Know the shuffling usage

Returns:
true is shuffle is enabled

setNumberOfThreads

public void setNumberOfThreads(int nThreads)
Define the number of threads to be used

Parameters:
nThreads - The number of thread must be > 0 (no check)

getNumberOfThreads

public int getNumberOfThreads()
Know the current number of threads to be used

Returns:
The number of threads

getRenormalizer

public Renormalizer getRenormalizer()
Retrieve the renormalizer object

Returns:
The renormalizer object

setRenormalizer

public void setRenormalizer(Renormalizer renormalizer)
Define the renormalizer object

Parameters:
renormalizer - The new renormalizer object

isHandelingMissingValues

public boolean isHandelingMissingValues()
Know if the measurer object must take care of missing values

Returns:
true if the measurer check missing values

setHandelingMissingValues

public void setHandelingMissingValues(boolean handleMissingValues)
Define the checking of missing values

Parameters:
handleMissingValues - true if the measurer must take care of missing values

fillMissing

public static final int fillMissing(boolean[] computable,
                                    double[] a,
                                    double[] b)
Fill computable array of boolean true iff a OR b contains a missing value

Parameters:
computable - The boolean array
a - The first data vector
b - The second data vector
Returns:
the number of missing values

measure

public Map<Measure,double[][]> measure(cern.colt.matrix.DoubleMatrix2D input,
                                       Measure[] measures)
Compute the given measures on data without ignored pairs

Parameters:
input - Input data (stay unchanged)
measures - The given measures
Returns:
The measured values put into a Mapping: Measure to array (upper triangular)

measure

public Map<Measure,double[][]> measure(cern.colt.matrix.DoubleMatrix2D input,
                                       Measure[] measures,
                                       boolean[][] measurable)
Compute the given measures on data

Parameters:
input - Input data (stay unchanged)
measures - The given measures
measurable - The boolean array which allow the computation between data pairs data[i] ,data[j] iff measurable[i][j] (eq. measurable[j][i]) is true
Returns:
The measured values put into a Mapping: Measure to array (upper triangular)

measure

public Map<Measure,double[][]> measure(double[][] input,
                                       Measure[] measures)
Compute the given measures on data without ignored pairs

Parameters:
input - Input data (stay unchanged)
measures - The given measures
Returns:
The measured values put into a Mapping: Measure to array (upper triangular)

measure

public Map<Measure,double[][]> measure(double[][] input,
                                       Measure[] measures,
                                       boolean[][] measurable)
Compute the given measures on data

Parameters:
input - Input data (stay unchanged)
measures - The given measures
measurable - The boolean array which allow the computation between data pairs data[i] ,data[j] iff measurable[i][j] (eq. measurable[j][i]) is true
Returns:
The measured values put into a Mapping: Measure to array (upper triangular)

isUsingNative

public boolean isUsingNative()
Know if the current measurer try to use the native implementation

Returns:
true iff trying to use the native implementation

useNative

public void useNative(boolean useNative)
Define the usage of the native implementation

Parameters:
useNative - true to use the native implementation

usePreShuffle

public void usePreShuffle(boolean shuffle)
Enable or disable pre-shuffle of data

Parameters:
shuffle - true to enable, false to disable

preShuffle

public boolean preShuffle()
Know if the renormalizer use pre-shuffle

Returns:
true if pre-shuffle is enabled, false otherwise

getMaximumMissingValues

public int getMaximumMissingValues()
Know the maximum number of missing values

Returns:
The maximum missing values which are allowed

setMaximumMissingValues

public void setMaximumMissingValues(int maxMissingValues)
Define the number of maximum allowed missing values

Parameters:
maxMissingValues - The number of missing values

hasNativeSupport

public static boolean hasNativeSupport()
Know if the native implementation is available

Returns:
True if the current execution support the native implementation