|
GATE Version 3.1-2270 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgate.creole.ml.weka.Wrapper
public class Wrapper
Wrapper class for the WEKA Machine Learning Engine.
Nested Class Summary | |
---|---|
protected class |
Wrapper.LoadDatasetFromArffAction
|
protected class |
Wrapper.LoadModelAction
|
protected class |
Wrapper.SaveDatasetAsArffAction
|
protected class |
Wrapper.SaveModelAction
|
Field Summary | |
---|---|
protected List |
actionsList
|
protected weka.classifiers.Classifier |
classifier
The WEKA classifier used by this wrapper |
protected weka.core.Instances |
dataset
The dataset used for training |
protected boolean |
datasetChanged
Marks whether the dataset was changed since the last time the classifier was built. |
protected DatasetDefintion |
datasetDefinition
|
protected File |
datasetFile
|
protected boolean |
onlyAccumulateDataset
This variable is set when the ML configuration file has neither the classifier nor the output dataset file option. |
protected org.jdom.Element |
optionsElement
The JDom element contaning the options fro this wrapper. |
protected ProcessingResource |
owner
|
protected StatusListener |
sListener
|
Constructor Summary | |
---|---|
Wrapper()
|
Method Summary | |
---|---|
protected void |
addTrainingInstance(weka.core.Instance instance)
|
void |
addTrainingInstance(List attributeValues)
Adds a new training instance to the dataset. |
List |
batchClassifyInstances(List instances)
Some wrappers allow batch classification, but this one doesn't, so if it's ever called just inform the user about this by throwing an exception. |
protected weka.core.Instance |
buildInstance(List attributeValues)
Constructs an instance valid for the current dataset from a list of attribute values. |
Object |
classifyInstance(List attributeValues)
Classifies a new instance. |
void |
cleanUp()
No clean up is needed for this wrapper, so this is just added because its in the interface. |
protected Object |
convertAttributeValue(double value)
|
List |
getActions()
Gets the list of actions that can be performed on this resource. |
DatasetDefintion |
getDatasetDefinition()
|
void |
init()
Initialises the classifier and prepares for running. |
void |
load(InputStream is)
Loads the state of this engine from previously saved data. |
void |
loadDatasetFromArff(FileReader reader)
|
protected String[] |
parseOptions(String optionsString)
|
void |
save(OutputStream os)
Saves the state of the engine for reuse at a later time. |
void |
saveDatasetAsARFF(FileWriter writer)
|
void |
setDatasetDefinition(DatasetDefintion definition)
Sets the definition for the dataset used. |
void |
setOptions(org.jdom.Element optionsElem)
Sets the options from an XML JDom element. |
void |
setOwnerPR(ProcessingResource pr)
Registers the PR using the engine with the engine itself. |
boolean |
supportsBatchMode()
Returns true if the engine supports BatchMode, returns false otherwise. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DatasetDefintion datasetDefinition
protected weka.classifiers.Classifier classifier
protected weka.core.Instances dataset
protected org.jdom.Element optionsElement
protected boolean datasetChanged
protected File datasetFile
protected List actionsList
protected ProcessingResource owner
protected StatusListener sListener
protected boolean onlyAccumulateDataset
Constructor Detail |
---|
public Wrapper()
Method Detail |
---|
public void cleanUp()
cleanUp
in interface MLEngine
public void setOptions(org.jdom.Element optionsElem)
MLEngine
setOptions
in interface MLEngine
optionsElem
- the JDom element containing the options from the
configuration.public List batchClassifyInstances(List instances) throws ExecutionException
batchClassifyInstances
in interface MLEngine
instances
- This parameter is not used.
ExecutionException
public void addTrainingInstance(List attributeValues) throws ExecutionException
MLEngine
addTrainingInstance
in interface MLEngine
attributeValues
- the list of attributes describing the instance. The
elements in the list are String values that need to be interpreted
according to the dataset definition: for nominal attributes the values will
used as they are; for numeric attributes the values will be converted to
double.
ExecutionException
protected void addTrainingInstance(weka.core.Instance instance) throws ExecutionException
ExecutionException
protected weka.core.Instance buildInstance(List attributeValues) throws ExecutionException
attributeValues
- the values for the attributes.
Instance
value.
ExecutionException
public void setDatasetDefinition(DatasetDefintion definition)
MLEngine
setDatasetDefinition
in interface MLEngine
public Object classifyInstance(List attributeValues) throws ExecutionException
MLEngine
classifyInstance
in interface MLEngine
attributeValues
- the list of attributes describing the instance. The
elements in the list are Object values that need to be interpreted
according to the dataset definition. The value for the class element will
be arbitrary.
ExecutionException
protected Object convertAttributeValue(double value)
public void init() throws GateException
init
in interface MLEngine
GateException
protected String[] parseOptions(String optionsString)
public void load(InputStream is) throws IOException
is
-
IOException
public void save(OutputStream os) throws IOException
os
-
IOException
public List getActions()
getActions
in interface ActionsPublisher
public void setOwnerPR(ProcessingResource pr)
setOwnerPR
in interface MLEngine
pr
- the processing resource that owns this engine.public DatasetDefintion getDatasetDefinition()
public void saveDatasetAsARFF(FileWriter writer)
public void loadDatasetFromArff(FileReader reader) throws IOException, ExecutionException, Exception
IOException
ExecutionException
Exception
public boolean supportsBatchMode()
AdvancedMLEngine
supportsBatchMode
in interface AdvancedMLEngine
|
GATE Version 3.1-2270 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |