@KFStep(name="Clusterer", category="Clusterers", toolTipText="Weka clusterer wrapper", iconPath="", resourceIntensive=true) public class Clusterer extends WekaAlgorithmWrapper implements PairedDataHelper.PairedProcessor<Clusterer>
| Modifier and Type | Field and Description |
|---|---|
protected Clusterer |
m_clustererTemplate
The template for constructing concrete instances of the clusterer to train
|
protected Data |
m_incrementalData
Re-usable Data object for incrementalClusterer output
|
protected boolean |
m_isReset
True if the step has just been reset
|
protected java.io.File |
m_loadModelFileName
Optional file to load a pre-trained model to score with (batch, or to score
and update (incremental) in the case of testSet only (batch) or instance
(incremental) connections
|
protected boolean |
m_streaming
True if there is a single incoming "instance" connection
|
protected Clusterer |
m_trainedClusterer
Holds a trained/loaded clusterer
|
protected Instances |
m_trainedClustererHeader
Header used to train the clusterer
|
protected PairedDataHelper<Clusterer> |
m_trainTestHelper
Handles train test pair routing and synchronization for us
|
m_defaultIconPath, m_defaultPackageIconPath, m_iconPath, m_wrappedAlgorithmm_stepIsResourceIntensive, m_stepManager, m_stepName| Constructor and Description |
|---|
Clusterer() |
| Modifier and Type | Method and Description |
|---|---|
Clusterer |
getClusterer()
Get the clusterer to train
|
java.util.List<java.lang.String> |
getIncomingConnectionTypes()
Get a list of connection types that could be made to this Step at this
point in time
|
java.io.File |
getLoadClustererFileName()
Get the name of the clusterer to load at execution time.
|
java.util.List<java.lang.String> |
getOutgoingConnectionTypes()
Get a list of outgoing connections that could be made from this step at
this point in time
|
java.lang.Class |
getWrappedAlgorithmClass()
Get the class of the wrapped algorithm
|
protected void |
loadModel(java.lang.String filePath)
Load a pre-trained model from the supplied path
|
protected void |
outputBatchClusterer(Clusterer clusterer,
int setNum,
int maxSetNum,
Instances trainingSplit,
Instances testSplit)
Output batch clusterer data to downstream steps
|
protected void |
outputGraphData(Clusterer clusterer,
int setNum)
Output a Data object containing a dot graph, if the model is Drawable and
we have downstream steps receiving graph connections.
|
protected void |
outputTextData(Clusterer clusterer,
int setNum)
Output a Data object containing a textual description of a model to any
outgoing text connections
|
void |
processIncoming(Data data)
Process an incoming data object
|
protected void |
processOnlyTestSet(Data data)
Process a Data object in the case where we only have an incoming testSet
connection
|
Clusterer |
processPrimary(java.lang.Integer setNum,
java.lang.Integer maxSetNum,
Data data,
PairedDataHelper<Clusterer> helper)
Process a training split (primary data handled by the PairedDataHelper)
|
void |
processSecondary(java.lang.Integer setNum,
java.lang.Integer maxSetNum,
Data data,
PairedDataHelper<Clusterer> helper)
Process a test split/fold (secondary data handled by PairedDataHelper)
|
void |
setClusterer(Clusterer clusterer)
Set the clusterer to train
|
void |
setLoadClustererFileName(java.io.File filename)
Set the name of the clusterer to load at execution time.
|
void |
setWrappedAlgorithm(java.lang.Object algo)
Set the wrapped algorithm
|
void |
stepInit()
Initialize the step
|
getDefaultIconPath, getDefaultPackageLevelIconPath, getIconPath, getWrappedAlgorithm, globalInfoenvironmentSubstitute, getCustomEditorForStep, getDefaultSettings, getInteractiveViewers, getInteractiveViewersImpls, getName, getStepManager, isResourceIntensive, isStopRequested, outputStructureForConnectionType, setName, setStepIsResourceIntensive, setStepManager, setStepMustRunSingleThreaded, start, stepMustRunSingleThreaded, stopprotected Clusterer m_clustererTemplate
protected Clusterer m_trainedClusterer
protected Instances m_trainedClustererHeader
protected transient PairedDataHelper<Clusterer> m_trainTestHelper
protected java.io.File m_loadModelFileName
protected boolean m_isReset
protected Data m_incrementalData
protected boolean m_streaming
public Clusterer getClusterer()
@ProgrammaticProperty public void setClusterer(Clusterer clusterer)
clusterer - the clusterer to trainpublic java.io.File getLoadClustererFileName()
@OptionMetadata(displayName="Clusterer model to load", description="Optional path to a clusterer to load at execution time (only applies when using testSet connections)") @FilePropertyMetadata(fileChooserDialogType=0, directoriesOnly=false) public void setLoadClustererFileName(java.io.File filename)
filename - the name of the file to load the model frompublic java.lang.Class getWrappedAlgorithmClass()
getWrappedAlgorithmClass in class WekaAlgorithmWrapperpublic void setWrappedAlgorithm(java.lang.Object algo)
setWrappedAlgorithm in class WekaAlgorithmWrapperalgo - the algorithm to wrappublic void stepInit()
throws WekaException
stepInit in interface BaseStepExtenderstepInit in interface StepWekaException - if a problem occurspublic void processIncoming(Data data) throws WekaException
processIncoming in interface BaseStepExtenderprocessIncoming in interface StepprocessIncoming in class BaseStepdata - the data to processWekaException - if a problem occursprotected void processOnlyTestSet(Data data) throws WekaException
data - the Data object to processWekaException - if a problem occurspublic java.util.List<java.lang.String> getIncomingConnectionTypes()
getIncomingConnectionTypes in interface BaseStepExtendergetIncomingConnectionTypes in interface Steppublic java.util.List<java.lang.String> getOutgoingConnectionTypes()
getOutgoingConnectionTypes in interface BaseStepExtendergetOutgoingConnectionTypes in interface Stepprotected void loadModel(java.lang.String filePath)
throws java.lang.Exception
filePath - the path to load the model fromjava.lang.Exception - if a problem occursprotected void outputGraphData(Clusterer clusterer, int setNum) throws WekaException
clusterer - the clusterer to generate the graph fromsetNum - the set number of the data used to generate the graphWekaException - if a problem occursprotected void outputTextData(Clusterer clusterer, int setNum) throws WekaException
clusterer - the clusterer to get the textual description ofsetNum - the set number of the training dataWekaException - if a problem occursprotected void outputBatchClusterer(Clusterer clusterer, int setNum, int maxSetNum, Instances trainingSplit, Instances testSplit) throws WekaException
clusterer - the clusterer to outpitsetNum - the set number of the current datasetmaxSetNum - the maximum set numbertrainingSplit - the training datatestSplit - the test data, or null if there is no test dataWekaException - if a problem occurspublic Clusterer processPrimary(java.lang.Integer setNum, java.lang.Integer maxSetNum, Data data, PairedDataHelper<Clusterer> helper) throws WekaException
processPrimary in interface PairedDataHelper.PairedProcessor<Clusterer>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 dataWekaException - if a problem occurspublic void processSecondary(java.lang.Integer setNum,
java.lang.Integer maxSetNum,
Data data,
PairedDataHelper<Clusterer> helper)
throws WekaException
processSecondary in interface PairedDataHelper.PairedProcessor<Clusterer>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 dataWekaException - if a problem occurs