Class AttributeWiseMeanNormalization<V extends elki.data.NumberVector>
- java.lang.Object
-
- elki.datasource.filter.AbstractConversionFilter<I,O>
-
- elki.datasource.filter.AbstractVectorConversionFilter<V,V>
-
- elki.datasource.filter.normalization.columnwise.AttributeWiseMeanNormalization<V>
-
- Type Parameters:
V- vector type
- All Implemented Interfaces:
Normalization<V>,elki.datasource.filter.ObjectFilter
public class AttributeWiseMeanNormalization<V extends elki.data.NumberVector> extends AbstractVectorConversionFilter<V,V> implements Normalization<V>
Normalization designed for data with a meaningful zero:
The 0 is retained, and the data is linearly scaled to have a mean of 1, by projection with f(x) = x / mean(X).Each attribute is processed separately.
- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intcCount the number of values seen.private static elki.logging.LoggingLOGClass logger.private double[]meanStores the mean in each dimension.(package private) double[]sumsTemporary storage used during initialization.-
Fields inherited from class elki.datasource.filter.AbstractVectorConversionFilter
factory
-
-
Constructor Summary
Constructors Constructor Description AttributeWiseMeanNormalization()Constructor.AttributeWiseMeanNormalization(double[] mean)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected elki.data.type.SimpleTypeInformation<? super V>convertedType(elki.data.type.SimpleTypeInformation<V> in)Get the output type from the input type after conversion.protected VfilterSingleObject(V featureVector)Normalize a single instance.protected elki.data.type.SimpleTypeInformation<? super V>getInputTypeRestriction()Get the input type restriction used for negotiating the data query.protected elki.logging.LogginggetLogger()Class logger.private doublenormalize(int d, double val)Normalize a single dimension.protected voidprepareComplete()Complete the initialization phase.protected voidprepareProcessInstance(V featureVector)Process a single object during initialization.protected booleanprepareStart(elki.data.type.SimpleTypeInformation<V> in)Return "true" when the normalization needs initialization (two-pass filtering!).private doublerestore(int d, double val)Restore a single dimension.Vrestore(V featureVector)Transforms a feature vector to the original attribute ranges.java.lang.StringtoString()elki.math.linearalgebra.LinearEquationSystemtransform(elki.math.linearalgebra.LinearEquationSystem linearEquationSystem)Transforms a linear equation system describing linear dependencies derived on the normalized space into a linear equation system describing linear dependencies quantitatively adapted to the original space.-
Methods inherited from class elki.datasource.filter.AbstractVectorConversionFilter
initializeOutputType
-
Methods inherited from class elki.datasource.filter.AbstractConversionFilter
filter
-
-
-
-
Method Detail
-
prepareStart
protected boolean prepareStart(elki.data.type.SimpleTypeInformation<V> in)
Description copied from class:AbstractConversionFilterReturn "true" when the normalization needs initialization (two-pass filtering!).- Overrides:
prepareStartin classAbstractConversionFilter<V extends elki.data.NumberVector,V extends elki.data.NumberVector>- Parameters:
in- Input type information- Returns:
- true or false
-
prepareProcessInstance
protected void prepareProcessInstance(V featureVector)
Description copied from class:AbstractConversionFilterProcess a single object during initialization.- Overrides:
prepareProcessInstancein classAbstractConversionFilter<V extends elki.data.NumberVector,V extends elki.data.NumberVector>- Parameters:
featureVector- Object to process
-
prepareComplete
protected void prepareComplete()
Description copied from class:AbstractConversionFilterComplete the initialization phase.- Overrides:
prepareCompletein classAbstractConversionFilter<V extends elki.data.NumberVector,V extends elki.data.NumberVector>
-
filterSingleObject
protected V filterSingleObject(V featureVector)
Description copied from class:AbstractConversionFilterNormalize a single instance. You can implement this as UnsupportedOperationException if you override both public "normalize" functions!- Specified by:
filterSingleObjectin classAbstractConversionFilter<V extends elki.data.NumberVector,V extends elki.data.NumberVector>- Parameters:
featureVector- Database object to normalize- Returns:
- Normalized database object
-
restore
public V restore(V featureVector) throws NonNumericFeaturesException
Description copied from interface:NormalizationTransforms a feature vector to the original attribute ranges.- Specified by:
restorein interfaceNormalization<V extends elki.data.NumberVector>- Parameters:
featureVector- a feature vector to be transformed into original space- Returns:
- a feature vector transformed into original space corresponding to the given feature vector
- Throws:
NonNumericFeaturesException- feature vector is not compatible with values initialized during normalization
-
normalize
private double normalize(int d, double val)Normalize a single dimension.- Parameters:
d- Dimensionval- Value- Returns:
- Normalized value
-
restore
private double restore(int d, double val)Restore a single dimension.- Parameters:
d- Dimensionval- Value- Returns:
- Normalized value
-
transform
public elki.math.linearalgebra.LinearEquationSystem transform(elki.math.linearalgebra.LinearEquationSystem linearEquationSystem)
Description copied from interface:NormalizationTransforms a linear equation system describing linear dependencies derived on the normalized space into a linear equation system describing linear dependencies quantitatively adapted to the original space.- Specified by:
transformin interfaceNormalization<V extends elki.data.NumberVector>- Parameters:
linearEquationSystem- the linear equation system to be transformed- Returns:
- a linear equation system describing linear dependencies derived on the normalized space transformed into a linear equation system describing linear dependencies quantitatively adapted to the original space
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractConversionFilter<V extends elki.data.NumberVector,V extends elki.data.NumberVector>
-
convertedType
protected elki.data.type.SimpleTypeInformation<? super V> convertedType(elki.data.type.SimpleTypeInformation<V> in)
Description copied from class:AbstractConversionFilterGet the output type from the input type after conversion.- Specified by:
convertedTypein classAbstractConversionFilter<V extends elki.data.NumberVector,V extends elki.data.NumberVector>- Parameters:
in- input type restriction- Returns:
- output type restriction
-
getLogger
protected elki.logging.Logging getLogger()
Description copied from class:AbstractConversionFilterClass logger.- Specified by:
getLoggerin classAbstractConversionFilter<V extends elki.data.NumberVector,V extends elki.data.NumberVector>- Returns:
- Logger
-
getInputTypeRestriction
protected elki.data.type.SimpleTypeInformation<? super V> getInputTypeRestriction()
Description copied from class:AbstractConversionFilterGet the input type restriction used for negotiating the data query.- Specified by:
getInputTypeRestrictionin classAbstractConversionFilter<V extends elki.data.NumberVector,V extends elki.data.NumberVector>- Returns:
- Type restriction
-
-