Package elki.datasource.filter.cleaning
Class ReplaceNaNWithRandomFilter
- java.lang.Object
-
- elki.datasource.filter.AbstractStreamFilter
-
- elki.datasource.filter.cleaning.ReplaceNaNWithRandomFilter
-
- All Implemented Interfaces:
BundleStreamSource
,ObjectFilter
,StreamFilter
public class ReplaceNaNWithRandomFilter extends AbstractStreamFilter
A filter to replace all NaN values with random values.Note: currently, only dense vector columns are supported.
TODO: add support for sparse vectors.
- Since:
- 0.6.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReplaceNaNWithRandomFilter.Par
Parameterization class.-
Nested classes/interfaces inherited from interface elki.datasource.bundle.BundleStreamSource
BundleStreamSource.Event
-
-
Field Summary
Fields Modifier and Type Field Description private NumberVector.Factory<?>[]
densecols
Columns to check.private Distribution
dist
Distribution to generate replacement values with.private static Logging
LOG
Class loggerprivate java.util.Random
rnd
Random generator.private java.util.ArrayList<java.lang.Object>
rows
Row cache.-
Fields inherited from class elki.datasource.filter.AbstractStreamFilter
source
-
-
Constructor Summary
Constructors Constructor Description ReplaceNaNWithRandomFilter(Distribution dist, RandomFactory rnd)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
data(int rnum)
Access a particular object and representation.MultipleObjectsBundle
filter(MultipleObjectsBundle objects)
Filter a set of object packages.BundleMeta
getMeta()
Get the current meta data.BundleStreamSource.Event
nextEvent()
Get the next eventprivate void
updateMeta(BundleMeta meta)
Process an updated meta record.-
Methods inherited from class elki.datasource.filter.AbstractStreamFilter
asMultipleObjectsBundle, assignDBID, hasDBIDs, init, toString
-
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger
-
densecols
private NumberVector.Factory<?>[] densecols
Columns to check.
-
dist
private Distribution dist
Distribution to generate replacement values with.
-
rows
private java.util.ArrayList<java.lang.Object> rows
Row cache.
-
rnd
private java.util.Random rnd
Random generator.
-
-
Constructor Detail
-
ReplaceNaNWithRandomFilter
public ReplaceNaNWithRandomFilter(Distribution dist, RandomFactory rnd)
Constructor.- Parameters:
dist
- Distribution to draw fromrnd
- Random generator
-
-
Method Detail
-
getMeta
public BundleMeta getMeta()
Description copied from interface:BundleStreamSource
Get the current meta data.- Returns:
- Metadata
-
data
public java.lang.Object data(int rnum)
Description copied from interface:BundleStreamSource
Access a particular object and representation.- Parameters:
rnum
- Representation number- Returns:
- Contained data
-
nextEvent
public BundleStreamSource.Event nextEvent()
Description copied from interface:BundleStreamSource
Get the next event- Returns:
- Event type
-
updateMeta
private void updateMeta(BundleMeta meta)
Process an updated meta record.- Parameters:
meta
- Meta record
-
filter
public MultipleObjectsBundle filter(MultipleObjectsBundle objects)
Description copied from interface:ObjectFilter
Filter a set of object packages.- Specified by:
filter
in interfaceObjectFilter
- Overrides:
filter
in classAbstractStreamFilter
- Parameters:
objects
- Object to filter- Returns:
- Filtered objects
-
-