be.ac.ulb.mlg.utils.renormalizer
Class TaxonRenormalizer

java.lang.Object
  extended by be.ac.ulb.mlg.utils.DefaultRenormalizer
      extended by be.ac.ulb.mlg.utils.renormalizer.TaxonRenormalizer
All Implemented Interfaces:
Renormalizer

public class TaxonRenormalizer
extends DefaultRenormalizer

This class represents a normalization with taxa. Each main taxon must be defined by calling addTaxa() method in order to normalize them and assemble them to their own root. Thus, if it exists a main root, you need to pre-remove it before to add taxons otherwise all data will be reduced to one row containing only an array of 1.0. For each row of the next input matrix, the lowest taxa level must be specified with the setTaxa() method after the definition of taxons. To design this class, some hypothesis are assumed: - Taxon are fully specified - Taxon doesn't contain overlaps (can be represented with a Tree: parents to children) => For each taxa, only one highest level All taxa/taxon is not case sensitive (according to the String case specification).


Field Summary
static String DEFAULT_SEPARATOR
          Default Taxa separator
 
Fields inherited from class be.ac.ulb.mlg.utils.DefaultRenormalizer
SUM_NORMILIZER
 
Constructor Summary
TaxonRenormalizer()
          Construct a new TaxonRenormalizer without predefined values Default applied renormalization is the default renormalization of the DefaultRenormalizer
 
Method Summary
 void addTaxa(String taxa)
          Add a taxa defintion of the main taxon according to the string format with the DEFAULT_SEPARATOR
 void addTaxa(String lineage, String separator)
          Add a taxa defintion of the main taxon according to the string format
 int[] getGroupResult()
          Get the mapping from (index) to (groups index identifier) for the new input matrix
 int getTaxaIdentifier(String taxa)
           
 boolean hasNativeImplementation()
          Know if the current renormalizer owns a native implementation
 boolean isHighestLevel(int taxa)
           
 boolean isHighestLevel(String taxa)
           
 boolean isHighLevel(int taxa)
           
 boolean isHighLevel(String taxa)
           
 boolean isLowLevel(int taxa)
           
 boolean isLowLevel(String taxa)
           
 double[][] normalizeInput(double[][] input)
          Apply the normalization process on the given vector of data vectors
 double[][] normalizeOutput(double[][] input, double[][] output, Measure measure)
          Apply the normalization process on the given vector of data vectors and result measures
 boolean processInput()
          Know if the renormalizer can handle input (call normalizeInput has effect)
 boolean processOutput()
          Know if the renormalizer can handle output (call normalizeOutput has effect)
 void reset()
          Reset only (no call to inherited reset methods) all data relative to taxa/taxon and mappings of last results
 void setTaxa(String[] taxas)
          Set the taxa for all row (null or out of taxon results in considering the row as a feature)
 void updateRenormalization(double[] vect, int row, boolean ignore)
          Method called when pairwise renormalization is used in order to ignore or not a row from the original input matrix
 
Methods inherited from class be.ac.ulb.mlg.utils.DefaultRenormalizer
addFeature, countFeatures, countGroups, groupOf, isUsingCustomNormalizer, isUsingFeatures, isUsingGroups, noFeatures, noGroups, resetNormalizer, setGroup, setGroup, setGroups, setGroupsNames, setNormalizer, setNormalizer, setNormalizer, shufflePair, simulateRenormalization, usePairShuffle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEPARATOR

public static final String DEFAULT_SEPARATOR
Default Taxa separator

See Also:
Constant Field Values
Constructor Detail

TaxonRenormalizer

public TaxonRenormalizer()
Construct a new TaxonRenormalizer without predefined values Default applied renormalization is the default renormalization of the DefaultRenormalizer

Method Detail

reset

public void reset()
Reset only (no call to inherited reset methods) all data relative to taxa/taxon and mappings of last results


getTaxaIdentifier

public int getTaxaIdentifier(String taxa)
Parameters:
taxa - The name of a defined taxa level
Returns:
The corresponding numeric taxa's identifier

isLowLevel

public boolean isLowLevel(String taxa)
Parameters:
taxa - The name of a defined taxa level
Returns:
true iff the taxa is one of the lowest levels, false otherwise

isHighLevel

public boolean isHighLevel(String taxa)
Parameters:
taxa - The name of a defined taxa level
Returns:
true iff the taxa is one of the higher levels, false if it is a lowest level

isHighestLevel

public boolean isHighestLevel(String taxa)
Parameters:
taxa - The index (according to the ordre of definition, see getTaxaIdentifier() method) of a definedtaxa level
Returns:
true iff the taxa is one of the highest levels, false otherwise

isLowLevel

public boolean isLowLevel(int taxa)
Parameters:
taxa - The index (according to the ordre of definition, see getTaxaIdentifier() method) of a defined taxa level
Returns:
true iff the taxa is one of the lowest levels, false otherwise

isHighLevel

public boolean isHighLevel(int taxa)
Parameters:
taxa - The index (according to the ordre of definition, see getTaxaIdentifier() method) of a defined taxa level
Returns:
true iff the taxa is one of the higher levels, false if it is a lowest level

isHighestLevel

public boolean isHighestLevel(int taxa)
Parameters:
taxa - The name of a defined taxa level
Returns:
true iff the taxa is one of the highest levels, false otherwise

setTaxa

public void setTaxa(String[] taxas)
Set the taxa for all row (null or out of taxon results in considering the row as a feature)

Parameters:
taxas - Taxa names of all row, one lowest level mapping for each row of the next input matrix

addTaxa

public void addTaxa(String taxa)
Add a taxa defintion of the main taxon according to the string format with the DEFAULT_SEPARATOR

Parameters:
taxa - The taxa definition from the highest level to the lowest level

addTaxa

public void addTaxa(String lineage,
                    String separator)
Add a taxa defintion of the main taxon according to the string format

Parameters:
lineage - The taxa definition from the highest level to the lowest level (cannot contains spaces see \s in RegularExpression)
separator - Specify the used separator (literal string)

normalizeInput

public double[][] normalizeInput(double[][] input)
Description copied from interface: Renormalizer
Apply the normalization process on the given vector of data vectors

Specified by:
normalizeInput in interface Renormalizer
Overrides:
normalizeInput in class DefaultRenormalizer
Parameters:
input - The given vector of data vectors
Returns:
the input array

updateRenormalization

public void updateRenormalization(double[] vect,
                                  int row,
                                  boolean ignore)
Description copied from interface: Renormalizer
Method called when pairwise renormalization is used in order to ignore or not a row from the original input matrix

Specified by:
updateRenormalization in interface Renormalizer
Overrides:
updateRenormalization in class DefaultRenormalizer
Parameters:
vect - A vector which is considerate as a row from the original input matrix corresponding to the row at the given index
row - The index of the vector to map it into the original matrix at this index
ignore - A boolean to tell if the values of the vector must be ignored (typically remove these values from the normalization process as if it was the row "index" from the original input matrix) with the true value (typically false to add it into renormalization)

getGroupResult

public int[] getGroupResult()
Get the mapping from (index) to (groups index identifier) for the new input matrix

Returns:
The mapping row index to the group's index of the resulting new input matrix

normalizeOutput

public double[][] normalizeOutput(double[][] input,
                                  double[][] output,
                                  Measure measure)
Description copied from interface: Renormalizer
Apply the normalization process on the given vector of data vectors and result measures

Specified by:
normalizeOutput in interface Renormalizer
Overrides:
normalizeOutput in class DefaultRenormalizer
Parameters:
input - The given vector of data vectors
output - The result vector (measures of data vectors)
measure - The corresponding measure
Returns:
the output array

hasNativeImplementation

public boolean hasNativeImplementation()
Description copied from interface: Renormalizer
Know if the current renormalizer owns a native implementation

Specified by:
hasNativeImplementation in interface Renormalizer
Overrides:
hasNativeImplementation in class DefaultRenormalizer
Returns:
true if the native implementation exists

processInput

public boolean processInput()
Description copied from interface: Renormalizer
Know if the renormalizer can handle input (call normalizeInput has effect)

Specified by:
processInput in interface Renormalizer
Overrides:
processInput in class DefaultRenormalizer
Returns:
true if it can handle

processOutput

public boolean processOutput()
Description copied from interface: Renormalizer
Know if the renormalizer can handle output (call normalizeOutput has effect)

Specified by:
processOutput in interface Renormalizer
Overrides:
processOutput in class DefaultRenormalizer
Returns:
true if it can handle