public class InputMappedClassifier extends SingleClassifierEnhancer implements Serializable, OptionHandler, Drawable, WeightedInstancesHandler, AdditionalMeasureProducer, EnvironmentHandler
-I Ignore case when matching attribute names and nominal values.
-M Suppress the output of the mapping report.
-trim Trim white space from either end of names before matching.
-L <path to model to load> Path to a model to load. If set, this model will be used for prediction and any base classifier specification will be ignored. Environment variables may be used in the path (e.g. ${HOME}/myModel.model)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.rules.ZeroR)
Options specific to classifier weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the console
BayesNet, Newick, NOT_DRAWABLE, TREE
Constructor and Description |
---|
InputMappedClassifier() |
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(Instances data)
Build the classifier
|
double |
classifyInstance(Instance inst)
Classifies the given test instance.
|
Instance |
constructMappedInstance(Instance incoming) |
double[] |
distributionForInstance(Instance inst)
Predicts the class memberships for a given instance.
|
Enumeration |
enumerateMeasures()
Returns an enumeration of the additional measure names
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
boolean |
getIgnoreCaseForNames()
Get whether to ignore case when matching attribute names
and nominal values.
|
int |
getMappedClassIndex() |
double |
getMeasure(String additionalMeasureName)
Returns the value of the named measure
|
Instances |
getModelHeader(Instances defaultH)
Return the instance structure that the encapsulated model was built with.
|
String |
getModelPath()
Get the path used for loading a model.
|
String[] |
getOptions()
Gets the current settings of the Classifier.
|
String |
getRevision()
Returns the revision string.
|
boolean |
getSuppressMappingReport()
Get whether to suppress output the report of model to input mappings.
|
boolean |
getTrim()
Get whether to trim white space from each end of names
before matching.
|
String |
globalInfo()
Returns a string describing this classifier
|
String |
graph()
Returns graph describing the classifier (if possible).
|
int |
graphType()
Returns the type of graph this classifier
represents.
|
String |
ignoreCaseForNamesTipText()
Returns the tip text for this property
|
Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] argv)
Main method for testing this class.
|
String |
modelPathTipText()
Returns the tip text for this property
|
void |
setEnvironment(Environment env)
Set the environment variables to use
|
void |
setIgnoreCaseForNames(boolean ignore)
Set whether to ignore case when matching attribute names and
nominal values.
|
void |
setModelHeader(Instances modelHeader)
Set the structure of the data used to create the model.
|
void |
setModelPath(String modelPath)
Set the path from which to load a model.
|
void |
setOptions(String[] options)
Parses a given list of options.
|
void |
setSuppressMappingReport(boolean suppress)
Set whether to suppress output the report of model to input mappings.
|
void |
setTestStructure(Instances testStructure)
Set the test structure (if known in advance) that we are likely
to see.
|
void |
setTrim(boolean trim)
Set whether to trim white space from each end of names
before matching.
|
String |
suppressMappingReportTipText()
Returns the tip text for this property
|
String |
toString() |
String |
trimTipText()
Returns the tip text for this property
|
classifierTipText, getClassifier, setClassifier
debugTipText, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug
public String globalInfo()
public void setEnvironment(Environment env)
setEnvironment
in interface EnvironmentHandler
env
- the environment variables to usepublic String ignoreCaseForNamesTipText()
public void setIgnoreCaseForNames(boolean ignore)
ignore
- true if case is to be ignoredpublic boolean getIgnoreCaseForNames()
public String trimTipText()
public void setTrim(boolean trim)
trim
- true to trim white space.public boolean getTrim()
public String suppressMappingReportTipText()
public void setSuppressMappingReport(boolean suppress)
suppress
- true to suppress this output.public boolean getSuppressMappingReport()
public String modelPathTipText()
public void setModelPath(String modelPath) throws Exception
modelPath
- the path to the model to load.Exception
- if a problem occurs during loading.public String getModelPath()
public Capabilities getCapabilities()
getCapabilities
in interface Classifier
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class SingleClassifierEnhancer
Capabilities
public Enumeration<Option> listOptions()
-I Ignore case when matching attribute names and nominal values.
-M Suppress the output of the mapping report.
-trim Trim white space from either end of names before matching.
-L <path to model to load> Path to a model to load. If set, this model will be used for prediction and any base classifier specification will be ignored. Environment variables may be used in the path (e.g. ${HOME}/myModel.model)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.rules.ZeroR)
Options specific to classifier weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the console
listOptions
in interface OptionHandler
listOptions
in class SingleClassifierEnhancer
public void setOptions(String[] options) throws Exception
-I Ignore case when matching attribute names and nominal values.
-M Suppress the output of the mapping report.
-trim Trim white space from either end of names before matching.
-L <path to model to load> Path to a model to load. If set, this model will be used for prediction and any base classifier specification will be ignored. Environment variables may be used in the path (e.g. ${HOME}/myModel.model)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.rules.ZeroR)
Options specific to classifier weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the consoleOptions after -- are passed to the designated classifier.
setOptions
in interface OptionHandler
setOptions
in class SingleClassifierEnhancer
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class SingleClassifierEnhancer
public void setTestStructure(Instances testStructure)
testStructure
- the structure of the test instances that
we are likely to see (if known in advance)public void setModelHeader(Instances modelHeader)
modelHeader
- the structure of the data used to build the wrapped
modelpublic void buildClassifier(Instances data) throws Exception
buildClassifier
in interface Classifier
data
- the training data to be used for generating the
bagged classifier.Exception
- if the classifier could not be built successfullypublic Instances getModelHeader(Instances defaultH) throws Exception
defaultH
- the default instances structureException
- if a problem occurspublic Instance constructMappedInstance(Instance incoming) throws Exception
Exception
public double classifyInstance(Instance inst) throws Exception
AbstractClassifier
classifyInstance
in interface Classifier
classifyInstance
in class AbstractClassifier
inst
- the instance to be classifiedException
- if an error occurred during the predictionpublic double[] distributionForInstance(Instance inst) throws Exception
AbstractClassifier
distributionForInstance
in interface Classifier
distributionForInstance
in class AbstractClassifier
inst
- the instance to be classifiedException
- if distribution could not be
computed successfullypublic int graphType()
public Enumeration enumerateMeasures()
enumerateMeasures
in interface AdditionalMeasureProducer
public double getMeasure(String additionalMeasureName)
getMeasure
in interface AdditionalMeasureProducer
additionalMeasureName
- the name of the measure to query for its valueIllegalArgumentException
- if the named measure is not supportedpublic String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class AbstractClassifier
public static void main(String[] argv)
argv
- should contain the following arguments:
-t training file [-T test file] [-c class index]Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.