Package moa.streams.filters
Class AbstractStreamFilter
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.streams.filters.AbstractStreamFilter
-
- All Implemented Interfaces:
Configurable
,Serializable
,CapabilitiesHandler
,MOAObject
,OptionHandler
,ExampleStream
,StreamFilter
- Direct Known Subclasses:
AddNoiseFilter
,HashingTrickFilter
,NormalisationFilter
,RandomProjectionFilter
,RBFFilter
,ReLUFilter
,RemoveDiscreteAttributeFilter
,ReplacingMissingValuesFilter
,StandardisationFilter
public abstract class AbstractStreamFilter extends AbstractOptionHandler implements StreamFilter
Abstract Stream Filter.- Version:
- $Revision: 7 $
- Author:
- Richard Kirkby (rkirkby@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ExampleStream
inputStream
The input stream to this filter.-
Fields inherited from class moa.options.AbstractOptionHandler
config
-
-
Constructor Summary
Constructors Constructor Description AbstractStreamFilter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description long
estimatedRemainingInstances()
Gets the estimated number of remaining instances in this streamInstance
filterInstance(Instance inst)
boolean
hasMoreInstances()
Gets whether this stream has more instances to output.boolean
isRestartable()
Gets whether this stream can restart.InstanceExample
nextInstance()
Gets the next example from this stream.void
prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
This method describes the implementation of how to prepare this object for use.void
restart()
Restarts this stream.protected abstract void
restartImpl()
Restarts this filter.void
setInputStream(ExampleStream stream)
Sets the input stream to the filter-
Methods inherited from class moa.options.AbstractOptionHandler
copy, getCLICreationString, getOptions, getPreparedClassOption, getPurposeString, prepareClassOptions, prepareForUse, prepareForUse
-
Methods inherited from class moa.AbstractMOAObject
copy, measureByteSize, measureByteSize, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface moa.capabilities.CapabilitiesHandler
getCapabilities
-
Methods inherited from interface moa.streams.ExampleStream
defineImmutableCapabilities, getHeader
-
Methods inherited from interface moa.MOAObject
getDescription, measureByteSize
-
-
-
-
Field Detail
-
inputStream
protected ExampleStream inputStream
The input stream to this filter.
-
-
Method Detail
-
setInputStream
public void setInputStream(ExampleStream stream)
Description copied from interface:StreamFilter
Sets the input stream to the filter- Specified by:
setInputStream
in interfaceStreamFilter
- Parameters:
stream
- the input stream to the filter
-
prepareForUseImpl
public void prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
Description copied from class:AbstractOptionHandler
This method describes the implementation of how to prepare this object for use. All classes that extends this class have to implementprepareForUseImpl
and notprepareForUse
sinceprepareForUse
callsprepareForUseImpl
.- Specified by:
prepareForUseImpl
in classAbstractOptionHandler
- Parameters:
monitor
- the TaskMonitor to userepository
- the ObjectRepository to use
-
estimatedRemainingInstances
public long estimatedRemainingInstances()
Description copied from interface:ExampleStream
Gets the estimated number of remaining instances in this stream- Specified by:
estimatedRemainingInstances
in interfaceExampleStream
- Returns:
- the estimated number of instances to get from this stream
-
hasMoreInstances
public boolean hasMoreInstances()
Description copied from interface:ExampleStream
Gets whether this stream has more instances to output. This is useful when reading streams from files.- Specified by:
hasMoreInstances
in interfaceExampleStream
- Returns:
- true if this stream has more instances to output
-
isRestartable
public boolean isRestartable()
Description copied from interface:ExampleStream
Gets whether this stream can restart.- Specified by:
isRestartable
in interfaceExampleStream
- Returns:
- true if this stream can restart
-
restart
public void restart()
Description copied from interface:ExampleStream
Restarts this stream. It must be similar to starting a new stream from scratch.- Specified by:
restart
in interfaceExampleStream
-
restartImpl
protected abstract void restartImpl()
Restarts this filter. All instances that extends fromAbstractStreamFilter
must implementrestartImpl
.restart
usesrestartImpl
inAbstractStreamFilter
.
-
nextInstance
public InstanceExample nextInstance()
Description copied from interface:ExampleStream
Gets the next example from this stream.- Specified by:
nextInstance
in interfaceExampleStream
- Returns:
- the next example of this stream
-
filterInstance
public Instance filterInstance(Instance inst)
- Specified by:
filterInstance
in interfaceStreamFilter
-
-