Package elki.datasource.filter.transform
Class NumberVectorRandomFeatureSelectionFilter<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.NumberVectorRandomFeatureSelectionFilter<V>
-
- Type Parameters:
V
- vector type
- All Implemented Interfaces:
BundleStreamSource
,ObjectFilter
,StreamFilter
public class NumberVectorRandomFeatureSelectionFilter<V extends NumberVector> extends AbstractVectorStreamConversionFilter<V,V>
Parser to project the ParsingResult obtained by a suitable base parser onto a randomly selected subset of attributes.- Since:
- 0.4.0
- Author:
- Arthur Zimek
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NumberVectorRandomFeatureSelectionFilter.Par
Parameterization class.-
Nested classes/interfaces inherited from interface elki.datasource.bundle.BundleStreamSource
BundleStreamSource.Event
-
-
Field Summary
Fields Modifier and Type Field Description protected int
k
Holds the desired cardinality of the subset of attributes selected for projection.protected RandomFactory
rnd
Holds a random generator.protected long[]
selectedAttributes
The selected attributes.-
Fields inherited from class elki.datasource.filter.AbstractVectorStreamConversionFilter
factory
-
Fields inherited from class elki.datasource.filter.AbstractStreamFilter
source
-
-
Constructor Summary
Constructors Constructor Description NumberVectorRandomFeatureSelectionFilter(int dim, RandomFactory rnd)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SimpleTypeInformation<? super 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.(package private) void
initializeRandomAttributes(SimpleTypeInformation<V> in)
Initialize random attributes.-
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
-
selectedAttributes
protected long[] selectedAttributes
The selected attributes.
-
k
protected int k
Holds the desired cardinality of the subset of attributes selected for projection.
-
rnd
protected RandomFactory rnd
Holds a random generator.
-
-
Constructor Detail
-
NumberVectorRandomFeatureSelectionFilter
public NumberVectorRandomFeatureSelectionFilter(int dim, RandomFactory rnd)
Constructor.- Parameters:
dim
- Dimensionalityrnd
- 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<? super 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
-
initializeRandomAttributes
void initializeRandomAttributes(SimpleTypeInformation<V> in)
Initialize random attributes. Invoke this fromconvertedType(elki.data.type.SimpleTypeInformation<V>)
!- Parameters:
in
- Type information.
-
-