Package elki.datasource.filter.transform
Class HistogramJitterFilter<V extends NumberVector>
- java.lang.Object
-
- elki.datasource.filter.AbstractStreamFilter
-
- elki.datasource.filter.AbstractStreamConversionFilter<I,O>
-
- elki.datasource.filter.AbstractVectorStreamConversionFilter<V,V>
-
- elki.datasource.filter.transform.HistogramJitterFilter<V>
-
- Type Parameters:
V
- Vector type
- All Implemented Interfaces:
BundleStreamSource
,ObjectFilter
,StreamFilter
@Description("Add uniform Jitter to a dataset, while preserving the total vector sum.") public class HistogramJitterFilter<V extends NumberVector> extends AbstractVectorStreamConversionFilter<V,V>
Add jitter, preserving the histogram properties (same sum, nonnegative).For each vector, the total sum of all dimensions is computed.
Then a random vector of the average lengthjitter * scale
is added and the result normalized to the original vectors sum. The individual dimensions are drawn from an exponential distribution with scalejitter / dimensionality
, so it is expected that the error in most dimensions will be low, and higher in few.This is designed to degrade the quality of a histogram, while preserving the total sum (e.g., to keep the normalization). The factor "jitter" can be used to control the degradation amount.
- Since:
- 0.5.5
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HistogramJitterFilter.Par
Parameterization class.-
Nested classes/interfaces inherited from interface elki.datasource.bundle.BundleStreamSource
BundleStreamSource.Event
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Distribution
dist
Random generator.(package private) double
jitter
Jitter amount.(package private) java.util.Random
rnd
Random generator.-
Fields inherited from class elki.datasource.filter.AbstractVectorStreamConversionFilter
factory
-
Fields inherited from class elki.datasource.filter.AbstractStreamFilter
source
-
-
Constructor Summary
Constructors Constructor Description HistogramJitterFilter(double jitter, RandomFactory rnd)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SimpleTypeInformation<V>
convertedType(SimpleTypeInformation<V> in)
Get the output type from the input type after conversion.protected V
filterSingleObject(V obj)
Normalize a single instance.protected SimpleTypeInformation<? super V>
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.-
Methods inherited from class elki.datasource.filter.AbstractVectorStreamConversionFilter
initializeOutputType
-
Methods inherited from class elki.datasource.filter.AbstractStreamConversionFilter
data, getMeta, nextEvent
-
Methods inherited from class elki.datasource.filter.AbstractStreamFilter
asMultipleObjectsBundle, assignDBID, filter, hasDBIDs, init, toString
-
-
-
-
Field Detail
-
jitter
double jitter
Jitter amount.
-
dist
Distribution dist
Random generator.
-
rnd
java.util.Random rnd
Random generator.
-
-
Constructor Detail
-
HistogramJitterFilter
public HistogramJitterFilter(double jitter, RandomFactory rnd)
Constructor.- Parameters:
jitter
- Relative amount of jitter to addrnd
- Random generator
-
-
Method Detail
-
filterSingleObject
protected V filterSingleObject(V obj)
Description copied from class:AbstractStreamConversionFilter
Normalize a single instance. You can implement this as UnsupportedOperationException if you override both public "normalize" functions!- Specified by:
filterSingleObject
in classAbstractStreamConversionFilter<V extends NumberVector,V extends NumberVector>
- Parameters:
obj
- Database object to normalize- Returns:
- Normalized database object
-
getInputTypeRestriction
protected SimpleTypeInformation<? super V> getInputTypeRestriction()
Description copied from class:AbstractStreamConversionFilter
Get the input type restriction used for negotiating the data query.- Specified by:
getInputTypeRestriction
in classAbstractStreamConversionFilter<V extends NumberVector,V extends NumberVector>
- Returns:
- Type restriction
-
convertedType
protected SimpleTypeInformation<V> convertedType(SimpleTypeInformation<V> in)
Description copied from class:AbstractStreamConversionFilter
Get the output type from the input type after conversion.- Specified by:
convertedType
in classAbstractStreamConversionFilter<V extends NumberVector,V extends NumberVector>
- Parameters:
in
- input type restriction- Returns:
- output type restriction
-
-