Package moa.streams.generators
Class MixedGenerator
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.streams.generators.MixedGenerator
-
- All Implemented Interfaces:
Configurable
,Serializable
,CapabilitiesHandler
,MOAObject
,OptionHandler
,ExampleStream<Example<Instance>>
,InstanceStream
public class MixedGenerator extends AbstractOptionHandler implements InstanceStream
Abrupt concept drift, boolean noise-free examples. Four relevant attributes, two boolean attributes v,w and two numeric attributes from [0; 1]. The examples are classified positive if two of three conditions are satisfied: v,w, y < 0,5 + 0,3 sin(3 * PI * x). After each context change the classification is reversed. Proposed by "Gama, Joao, et al. "Learning with drift detection." Advances in artificial intelligence–SBIA 2004. Springer Berlin Heidelberg, 2004. 286-295."- Version:
- $Revision: 1 $
- Author:
- Paulo Gonçalves (paulogoncalves@recife.ifpe.edu.br)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
MixedGenerator.ClassFunction
-
Field Summary
Fields Modifier and Type Field Description FlagOption
balanceClassesOption
protected static MixedGenerator.ClassFunction[]
classificationFunctions
IntOption
functionOption
protected Random
instanceRandom
IntOption
instanceRandomSeedOption
protected boolean
nextClassShouldBeZero
protected InstancesHeader
streamHeader
-
Fields inherited from class moa.options.AbstractOptionHandler
config
-
-
Constructor Summary
Constructors Constructor Description MixedGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
estimatedRemainingInstances()
Gets the estimated number of remaining instances in this streamvoid
getDescription(StringBuilder sb, int indent)
Returns a string representation of this object.InstancesHeader
getHeader()
Gets the header of this stream.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.protected void
prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository)
This method describes the implementation of how to prepare this object for use.void
restart()
Restarts this stream.-
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
-
Methods inherited from interface moa.MOAObject
measureByteSize
-
-
-
-
Field Detail
-
functionOption
public IntOption functionOption
-
instanceRandomSeedOption
public IntOption instanceRandomSeedOption
-
balanceClassesOption
public FlagOption balanceClassesOption
-
streamHeader
protected InstancesHeader streamHeader
-
instanceRandom
protected Random instanceRandom
-
nextClassShouldBeZero
protected boolean nextClassShouldBeZero
-
classificationFunctions
protected static MixedGenerator.ClassFunction[] classificationFunctions
-
-
Method Detail
-
getDescription
public void getDescription(StringBuilder sb, int indent)
Description copied from interface:MOAObject
Returns a string representation of this object. Used inAbstractMOAObject.toString
to give a string representation of the object.- Specified by:
getDescription
in interfaceMOAObject
- Parameters:
sb
- the stringbuilder to add the descriptionindent
- the number of characters to indent
-
getHeader
public InstancesHeader getHeader()
Description copied from interface:ExampleStream
Gets the header of this stream. This is useful to know attributes and classes. InstancesHeader is an extension of weka.Instances.- Specified by:
getHeader
in interfaceExampleStream<Example<Instance>>
- Returns:
- the header of this stream
-
estimatedRemainingInstances
public long estimatedRemainingInstances()
Description copied from interface:ExampleStream
Gets the estimated number of remaining instances in this stream- Specified by:
estimatedRemainingInstances
in interfaceExampleStream<Example<Instance>>
- 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<Example<Instance>>
- Returns:
- true if this stream has more instances to output
-
nextInstance
public InstanceExample nextInstance()
Description copied from interface:ExampleStream
Gets the next example from this stream.- Specified by:
nextInstance
in interfaceExampleStream<Example<Instance>>
- Returns:
- the next example of this stream
-
isRestartable
public boolean isRestartable()
Description copied from interface:ExampleStream
Gets whether this stream can restart.- Specified by:
isRestartable
in interfaceExampleStream<Example<Instance>>
- 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<Example<Instance>>
-
prepareForUseImpl
protected 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
-
-