public class DefaultRenormalizer extends java.lang.Object implements Renormalizer<double[][]>
| Modifier and Type | Field and Description |
|---|---|
static double |
SUM_NORMILIZER
Sentinel value meaning that the renormalizer use the sum function on columns
|
| Constructor and Description |
|---|
DefaultRenormalizer()
Construct a new DefaultRenormalizer without groups, without features and with sum normalization
shuffles are disable
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFeature(int dataIndex) |
double[][] |
cloneState()
Avoid concurrent modification and inconsistent results when multi-threading is enabled.
|
int |
countFeatures()
Count the number of features
|
int |
countGroups()
Count the number of groups
|
int |
groupOf(int row)
Get the group of a row
|
boolean |
hasNativeImplementation()
Know if the current renormalizer owns a native implementation
|
boolean |
isUsingCustomNormalizer()
Know if the configuration of the DefaultRenormalizer uses custom renormalization values
|
boolean |
isUsingFeatures()
Know if the configuration of the DefaultRenormalizer use the feature renormalization
|
boolean |
isUsingGroups()
Know if the configuration of the DefaultRenormalizer use the group renormalization
|
protected void |
mergeRenormalizer(double[][] sum) |
void |
noFeatures()
Specifies to no longer use the features renormalization
|
void |
noGroups()
Specifies to no longer use the group renormalization
but preserve renormalization values by group
to rester them, use resetNormalizer()
|
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
|
protected void |
prepareRenormalization(double[][] sum,
double[] vect,
int row,
boolean ignore) |
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 |
resetNormalizer()
Reset the custom renormalizer to use the default method (sum by columns)
|
void |
setGroup(int row,
int group)
Define the group for one input data vector
|
void |
setGroup(int row,
java.lang.String groupName)
Define the group for one input data vector
|
void |
setGroups(int[] groups,
int groupCount)
Define the group of all input data vectors by their indexes
|
void |
setGroupsNames(int rows,
java.lang.String[] names)
Define groups and associate them a label.
|
void |
setNormalizer(int column,
double divider)
Define a specific value to use instead of the sum by column
|
void |
setNormalizer(int group,
int column,
double divider)
Define a specific value to use instead of the sum by column for groups
|
void |
setNormalizer(java.lang.String groupName,
int column,
double divider)
Define a specific value to use instead of the sum by column for groups
|
boolean |
shufflePair()
Know if the measurer use pre-shuffle
|
void |
simulateRenormalization(double[][] sum,
double[] shuffledFirst,
double[] shuffledSecond,
int first,
int second)
Method called when pairwise renormalization is used in order to obtain a normalized version of the shuffled vector as if it was in the original input matrix
|
void |
updateRenormalization(double[][] sum,
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
|
void |
usePairShuffle(boolean shuffle)
Enable or disable pairwise shuffle
|
public static final double SUM_NORMILIZER
public DefaultRenormalizer()
public void addFeature(int dataIndex)
public boolean isUsingGroups()
public void noGroups()
public void resetNormalizer()
public boolean isUsingFeatures()
public boolean isUsingCustomNormalizer()
public void noFeatures()
public void setGroup(int row,
java.lang.String groupName)
row - The index of the input data vector (used with Measurer)groupName - The name of the group of the input data vectorpublic void setGroup(int row,
int group)
row - The index of the input data vector (used with Measurer)group - The index of the group of the input data vectorpublic void setGroupsNames(int rows,
java.lang.String[] names)
rows - The number of input data vectors to be processednames - The name of all existing groupspublic void setGroups(int[] groups,
int groupCount)
groups - The array mapping each for index i, the input data vector i to the group groups[i]groupCount - The number of groupspublic void setNormalizer(java.lang.String groupName,
int column,
double divider)
groupName - The name of the groupcolumn - The column index (for an input data vector v, it's i of v[i])divider - The specific value to use as normalizerpublic void setNormalizer(int group,
int column,
double divider)
group - The index of the groupcolumn - The column index (for an input data vector v, it's i of v[i])divider - The specific value to use as normalizerpublic void setNormalizer(int column,
double divider)
column - The column index (for an input data vector v, it's i of v[i])divider - The specific value to use as normalizerpublic int countFeatures()
public int countGroups()
public int groupOf(int row)
row - The row indexprotected void mergeRenormalizer(double[][] sum)
public double[][] normalizeInput(double[][] input)
RenormalizernormalizeInput in interface Renormalizer<double[][]>input - The given vector of data vectorspublic void updateRenormalization(double[][] sum,
double[] vect,
int row,
boolean ignore)
RenormalizerupdateRenormalization in interface Renormalizer<double[][]>sum - The state on which modifications will be appliedvect - A vector which is considerate as a row from the original input matrix corresponding to the row at the given indexrow - The index of the vector to map it into the original matrix at this indexignore - 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)protected void prepareRenormalization(double[][] sum,
double[] vect,
int row,
boolean ignore)
public void simulateRenormalization(double[][] sum,
double[] shuffledFirst,
double[] shuffledSecond,
int first,
int second)
RenormalizersimulateRenormalization in interface Renormalizer<double[][]>sum - The state on which modifications will be appliedshuffledFirst - The first vector of the pairwise comparison (shuffled version)shuffledSecond - The second vector of the pairwise comparison (shuffled version)first - The index of the first vector from the original input matrixsecond - The index of the second vector from the original input matrixpublic double[][] normalizeOutput(double[][] input,
double[][] output,
Measure measure)
RenormalizernormalizeOutput in interface Renormalizer<double[][]>input - The given vector of data vectorsoutput - The result vector (measures of data vectors)measure - The corresponding measurepublic boolean hasNativeImplementation()
RenormalizerhasNativeImplementation in interface Renormalizer<double[][]>public boolean processInput()
RenormalizerprocessInput in interface Renormalizer<double[][]>public boolean processOutput()
RenormalizerprocessOutput in interface Renormalizer<double[][]>public void usePairShuffle(boolean shuffle)
shuffle - true to enable, false to disablepublic boolean shufflePair()
RenormalizershufflePair in interface Renormalizer<double[][]>public double[][] cloneState()
RenormalizercloneState in interface Renormalizer<double[][]>