Package moa.streams.generators
Class AgrawalGenerator
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.options.AbstractOptionHandler
-
- moa.streams.generators.AgrawalGenerator
-
- All Implemented Interfaces:
Configurable
,Serializable
,CapabilitiesHandler
,MOAObject
,OptionHandler
,ExampleStream<Example<Instance>>
,InstanceStream
public class AgrawalGenerator extends AbstractOptionHandler implements InstanceStream, CapabilitiesHandler
Stream generator for Agrawal dataset. Generator described in paper:
Rakesh Agrawal, Tomasz Imielinksi, and Arun Swami, "Database Mining: A Performance Perspective", IEEE Transactions on Knowledge and Data Engineering, 5(6), December 1993.
Public C source code available at:
http://www.almaden.ibm.com/cs/projects/iis/hdb/Projects/data_mining/datasets/syndata.html
Notes:
The built in functions are based on the paper (page 924), which turn out to be functions pred20 thru pred29 in the public C implementation. Perturbation function works like C implementation rather than description in paper.- Version:
- $Revision: 7 $
- Author:
- Richard Kirkby (rkirkby@cs.waikato.ac.nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
AgrawalGenerator.ClassFunction
-
Field Summary
Fields Modifier and Type Field Description FlagOption
balanceClassesOption
protected static AgrawalGenerator.ClassFunction[]
classificationFunctions
IntOption
functionOption
protected Random
instanceRandom
IntOption
instanceRandomSeedOption
protected boolean
nextClassShouldBeZero
FloatOption
peturbFractionOption
protected InstancesHeader
streamHeader
-
Fields inherited from class moa.options.AbstractOptionHandler
config
-
-
Constructor Summary
Constructors Constructor Description AgrawalGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableCapabilities
defineImmutableCapabilities()
Defines the set of capabilities the object has.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.String
getPurposeString()
Dictionary with option texts and objectsboolean
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 double
perturbValue(double val, double min, double max)
protected double
perturbValue(double val, double range, double min, double max)
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, 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.MOAObject
measureByteSize
-
-
-
-
Field Detail
-
functionOption
public IntOption functionOption
-
instanceRandomSeedOption
public IntOption instanceRandomSeedOption
-
peturbFractionOption
public FloatOption peturbFractionOption
-
balanceClassesOption
public FlagOption balanceClassesOption
-
classificationFunctions
protected static AgrawalGenerator.ClassFunction[] classificationFunctions
-
streamHeader
protected InstancesHeader streamHeader
-
instanceRandom
protected Random instanceRandom
-
nextClassShouldBeZero
protected boolean nextClassShouldBeZero
-
-
Method Detail
-
getPurposeString
public String getPurposeString()
Description copied from class:AbstractOptionHandler
Dictionary with option texts and objects- Specified by:
getPurposeString
in interfaceOptionHandler
- Overrides:
getPurposeString
in classAbstractOptionHandler
- Returns:
- the string with the purpose of this object
-
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
-
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
-
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
-
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
-
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
-
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
-
perturbValue
protected double perturbValue(double val, double min, double max)
-
perturbValue
protected double perturbValue(double val, double range, double min, double max)
-
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>>
-
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
-
defineImmutableCapabilities
public ImmutableCapabilities defineImmutableCapabilities()
Description copied from interface:CapabilitiesHandler
Defines the set of capabilities the object has. Should be overridden if the object's capabilities do not change.- Specified by:
defineImmutableCapabilities
in interfaceCapabilitiesHandler
- Specified by:
defineImmutableCapabilities
in interfaceExampleStream<Example<Instance>>
- Returns:
- The capabilities of the object.
-
-