Package weka.knowledgeflow.steps
Class Classifier
java.lang.Object
weka.knowledgeflow.steps.BaseStep
weka.knowledgeflow.steps.WekaAlgorithmWrapper
weka.knowledgeflow.steps.Classifier
- All Implemented Interfaces:
Serializable,BaseStepExtender,PairedDataHelper.PairedProcessor<Classifier>,Step
@KFStep(name="Classifier",
category="Classifiers",
toolTipText="Weka classifier wrapper",
iconPath="",
resourceIntensive=true)
public class Classifier
extends WekaAlgorithmWrapper
implements PairedDataHelper.PairedProcessor<Classifier>
Step that wraps a Weka classifier. Handles instance, trainingSet and testSet
incoming connections. If the base classifier is Updateable, then it can be
optionally updated incrementall on an incoming connection of type instance.
Otherwise, instance connections are used for testing a classifier
incrementally. In the case of a single incoming testSet connection it is
assumed that the classifier has already been trained.
- Version:
- $Revision: $
- Author:
- Mark Hall (mhall{[at]}pentaho{[dot]}com)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the classifier to trainGet a list of incoming connection types that this step can accept.Get the name of the classifier to load at execution time.Get a list of outgoing connection types that this step can produce.booleanGet whether to reset an incremental classifier at the start of an incoming instance streambooleanGet whether to update an incremental classifier on an incoming instance streamGet the class of the algorithm being wrappedvoidprocessIncoming(Data data) Process an incoming data payload (if the step accepts incoming connections)processPrimary(Integer setNum, Integer maxSetNum, Data data, PairedDataHelper<Classifier> helper) Process a training split (primary data handled by the PairedDataHelper)voidprocessSecondary(Integer setNum, Integer maxSetNum, Data data, PairedDataHelper<Classifier> helper) Process a test split/fold (secondary data handled by PairedDataHelper)voidsetClassifier(Classifier classifier) Set the classifier to trainvoidsetLoadClassifierFileName(File filename) Set the name of the classifier to load at execution time.voidsetResetIncrementalClassifier(boolean reset) Set whether to reset an incremental classifier at the start of an incoming instance streamvoidsetUpdateIncrementalClassifier(boolean update) Set whether to update an incremental classifier on an incoming instance streamvoidsetWrappedAlgorithm(Object algo) Set the wrapped algorithmvoidstepInit()Initialize the step.Methods inherited from class weka.knowledgeflow.steps.WekaAlgorithmWrapper
getDefaultIconPath, getDefaultPackageLevelIconPath, getIconPath, getWrappedAlgorithm, globalInfoMethods inherited from class weka.knowledgeflow.steps.BaseStep
environmentSubstitute, getCustomEditorForStep, getDefaultSettings, getInteractiveViewers, getInteractiveViewersImpls, getName, getStepManager, isResourceIntensive, isStopRequested, outputStructureForConnectionType, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stop
-
Constructor Details
-
Classifier
public Classifier()
-
-
Method Details
-
getWrappedAlgorithmClass
Description copied from class:WekaAlgorithmWrapperGet the class of the algorithm being wrapped- Specified by:
getWrappedAlgorithmClassin classWekaAlgorithmWrapper- Returns:
- the class of the algorithm being wrapped
-
setWrappedAlgorithm
Description copied from class:WekaAlgorithmWrapperSet the wrapped algorithm- Overrides:
setWrappedAlgorithmin classWekaAlgorithmWrapper- Parameters:
algo- the algorithm to wrao
-
getClassifier
Get the classifier to train- Returns:
- the classifier to train
-
setClassifier
Set the classifier to train- Parameters:
classifier- the classifier to train
-
stepInit
Description copied from interface:StepInitialize the step.- Specified by:
stepInitin interfaceBaseStepExtender- Specified by:
stepInitin interfaceStep- Throws:
WekaException- if a problem occurs during initialization
-
getLoadClassifierFileName
Get the name of the classifier to load at execution time. This only applies in the case where the only incoming connection is a test set connection (batch mode) or an instance connection (incremental mode).- Returns:
- the name of the file to load the model from
-
setLoadClassifierFileName
@OptionMetadata(displayName="Classifier model to load", description="Optional Path to a classifier to load at execution time (only applies when using testSet or instance connections)") @FilePropertyMetadata(fileChooserDialogType=0, directoriesOnly=false) public void setLoadClassifierFileName(File filename) Set the name of the classifier to load at execution time. This only applies in the case where the only incoming connection is a test set connection (batch mode) or an instance connection (incremental mode).- Parameters:
filename- the name of the file to load the model from
-
getResetIncrementalClassifier
public boolean getResetIncrementalClassifier()Get whether to reset an incremental classifier at the start of an incoming instance stream- Returns:
- true if the classifier should be reset
-
setResetIncrementalClassifier
@OptionMetadata(displayName="Reset incremental classifier", description="Reset classifier (if it is incremental) at the start of the incoming instance stream") public void setResetIncrementalClassifier(boolean reset) Set whether to reset an incremental classifier at the start of an incoming instance stream- Parameters:
reset- true if the classifier should be reset
-
getUpdateIncrementalClassifier
public boolean getUpdateIncrementalClassifier()Get whether to update an incremental classifier on an incoming instance stream- Returns:
- true if an incremental classifier should be updated
-
setUpdateIncrementalClassifier
@OptionMetadata(displayName="Update incremental classifier", description=" Update an incremental classifier on incoming instance stream") public void setUpdateIncrementalClassifier(boolean update) Set whether to update an incremental classifier on an incoming instance stream- Parameters:
update- true if an incremental classifier should be updated
-
processIncoming
Description copied from class:BaseStepProcess an incoming data payload (if the step accepts incoming connections)- Specified by:
processIncomingin interfaceBaseStepExtender- Specified by:
processIncomingin interfaceStep- Overrides:
processIncomingin classBaseStep- Parameters:
data- the payload to process- Throws:
WekaException- if a problem occurs
-
processPrimary
public Classifier processPrimary(Integer setNum, Integer maxSetNum, Data data, PairedDataHelper<Classifier> helper) throws WekaException Process a training split (primary data handled by the PairedDataHelper)- Specified by:
processPrimaryin interfacePairedDataHelper.PairedProcessor<Classifier>- Parameters:
setNum- the number of this split/foldmaxSetNum- the maximum number of splits/folds in the groupdata- the actual split/fold datahelper- the PairedDataHelper managing the paired data- Returns:
- a Classifier trained on this training split
- Throws:
WekaException- if a problem occurs
-
processSecondary
public void processSecondary(Integer setNum, Integer maxSetNum, Data data, PairedDataHelper<Classifier> helper) throws WekaException Process a test split/fold (secondary data handled by PairedDataHelper)- Specified by:
processSecondaryin interfacePairedDataHelper.PairedProcessor<Classifier>- Parameters:
setNum- the set number of this split/foldmaxSetNum- the maximum number of splits/folds in the groupdata- the actual split/fold datahelper- the PairedDataHelper managing the paried data- Throws:
WekaException- if a problem occurs
-
getIncomingConnectionTypes
Description copied from interface:StepGet a list of incoming connection types that this step can accept. Ideally (and if appropriate), this should take into account the state of the step and any existing incoming connections. E.g. a step might be able to accept one (and only one) incoming batch data connection.- Specified by:
getIncomingConnectionTypesin interfaceBaseStepExtender- Specified by:
getIncomingConnectionTypesin interfaceStep- Returns:
- a list of incoming connections that this step can accept given its current state
-
getOutgoingConnectionTypes
Description copied from interface:StepGet a list of outgoing connection types that this step can produce. Ideally (and if appropriate), this should take into account the state of the step and the incoming connections. E.g. depending on what incoming connection is present, a step might be able to produce a trainingSet output, a testSet output or neither, but not both.- Specified by:
getOutgoingConnectionTypesin interfaceBaseStepExtender- Specified by:
getOutgoingConnectionTypesin interfaceStep- Returns:
- a list of outgoing connections that this step can produce
-