|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.classifiers.AbstractClassifier
weka.classifiers.SingleClassifierEnhancer
weka.classifiers.misc.InputMappedClassifier
public class InputMappedClassifier
Wrapper classifier that addresses incompatible training and test data by building a mapping between the training data that a classifier has been built with and the incoming test instances' structure. Model attributes that are not found in the incoming instances receive missing values, so do incoming nominal attribute values that the classifier has not seen before. A new classifier can be trained or an existing one loaded from a file.
Valid options are:-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
| Field Summary |
|---|
| Fields inherited from interface weka.core.Drawable |
|---|
BayesNet, Newick, NOT_DRAWABLE, TREE |
| Constructor Summary | |
|---|---|
InputMappedClassifier()
|
|
| Method Summary | |
|---|---|
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 |
| Methods inherited from class weka.classifiers.SingleClassifierEnhancer |
|---|
classifierTipText, getClassifier, setClassifier |
| Methods inherited from class weka.classifiers.AbstractClassifier |
|---|
debugTipText, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public InputMappedClassifier()
| Method Detail |
|---|
public String globalInfo()
public void setEnvironment(Environment env)
setEnvironment in interface EnvironmentHandlerenv - 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 ClassifiergetCapabilities in interface CapabilitiesHandlergetCapabilities in class SingleClassifierEnhancerCapabilitiespublic 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 OptionHandlerlistOptions 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 OptionHandlersetOptions in class SingleClassifierEnhanceroptions - the list of options as an array of strings
Exception - if an option is not supportedpublic String[] getOptions()
getOptions in interface OptionHandlergetOptions in class SingleClassifierEnhancerpublic 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
model
public void buildClassifier(Instances data)
throws Exception
buildClassifier in interface Classifierdata - the training data to be used for generating the
bagged classifier.
Exception - if the classifier could not be built successfully
public Instances getModelHeader(Instances defaultH)
throws Exception
defaultH - the default instances structure
Exception - if a problem occurs
public int getMappedClassIndex()
throws Exception
Exception
public Instance constructMappedInstance(Instance incoming)
throws Exception
Exception
public double classifyInstance(Instance inst)
throws Exception
AbstractClassifier
classifyInstance in interface ClassifierclassifyInstance in class AbstractClassifierinst - the instance to be classified
Exception - if an error occurred during the prediction
public double[] distributionForInstance(Instance inst)
throws Exception
AbstractClassifier
distributionForInstance in interface ClassifierdistributionForInstance in class AbstractClassifierinst - the instance to be classified
Exception - if distribution could not be
computed successfullypublic String toString()
toString in class Objectpublic int graphType()
graphType in interface Drawablepublic Enumeration enumerateMeasures()
enumerateMeasures in interface AdditionalMeasureProducerpublic double getMeasure(String additionalMeasureName)
getMeasure in interface AdditionalMeasureProduceradditionalMeasureName - the name of the measure to query for its value
IllegalArgumentException - if the named measure is not supported
public String graph()
throws Exception
graph in interface DrawableException - if the classifier cannot be graphedpublic String getRevision()
getRevision in interface RevisionHandlergetRevision in class AbstractClassifierpublic static void main(String[] argv)
argv - should contain the following arguments:
-t training file [-T test file] [-c class index]
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||